javascript - ajax success call back function was not called when the dataType is JSONP.in Cross domain Access -
type = 'calci'; var ajurl = "example.com&callback=mycallback"; var datas = "cateid=" + cateid + "&type=" + type + "&pno=" + pno + "&whos=" + whos; $.ajax({ type: "get", url: ajurl, data: datas, contenttype: "application/json; charset=utf-8;", datatype: "jsonp", jsonp: 'callback', username: "abcdxyz", password: "lkjljlmkjhlkj", success: function(data) { alert('success...'); console.log(data); }, jsonpcallback: 'mycallback', error: function(xhr, ajaxoptions alert(xhr.status); alert(thrownerror); } });
i have defined call function
function mycallback(jsondata){ console.log(jsondata+"check"); $('#calcilist').html(jsondata); }
if print error shows either call function not defined or queryasjdkbaskjds1298372981379284-2132 not called.
from url try change &callback=mycallback
&callback=?
or remove , change from
jsonp: 'callback',
to
jsonp: false,
Comments
Post a Comment