I am trying to get the URL variable (pid) into the ajax request (url) and haven't got any success.
My url is: www.domain.com/news.html?pid=1256
My java script:
$(document).ready(function() {
var output = $('#news');
var id = jQuery(this).attr('pid');
$.ajax({
    url: 'http://www.domain.com/?post_type=news&post_id=' + id,
    async: false,
    callback: 'callback',
    crossDomain: true,
    contentType: 'application/json; charset=utf-8',
    type: 'POST',
    dataType: 'jsonp',
    timeout: 5000,
    success: function(data, status) {
        $.each(data.posts, function(i, item) {
            var news = '<div>' + item.title + '</div><div>' + item.content + '</div><hr/>';
            output.append(news);
        });
    },
    error: function() {
        output.text('There was an error loading the data.');
    }
});})
Thanks a lot for you help.
 
     
    