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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -