Всем моим друзьям, у которых проблемы с PHP + JQuery + JSONP
, я использую php 5.3 и Jquery 1.10
$('#button_submit2').click(function () {
prevent_caching = (new Date()).getTime();
$.ajax({
type: 'GET'
, url: "http://yoururl.com/webservice.php"
, dataType: 'jsonp' //Besides plain xml, the dataType can be html, json, jsonp, script, or text.
, jsonp: 'callback' //this will be added in the query as parameter
, jsonpCallback: 'jsonp_reply' //this is what ajax call is expecting json to be encapsulated ine i.e. json_reply(JSON_RESPONSE)
, data: {
uniq_val: prevent_caching
, method_name: "get_all_tasks"
, format: 'jsonp'
}
, cache: false
, async: false
})
.success(function (rsp) {
console.log('success'+rsp);
})
.fail(function (xhr, error, thrownError) {
console.log('fail status:[' + xhr.status + '] error:[' + thrownError + ']');
})
.always(function () {
console.log('complete');
});
});