c# - $.getJSON is not calling call back function -


call in not being called.

function gettrainingresults(id,callback){     $.getjson("/dashboard/gettrainingresults/", {'id':id}, callback); } gettrainingresults('id',function(result){     alert(result); }); 

and code behind

 public actionresult gettrainingresults(int id)     {         string test = "you there.";         return json(test, jsonrequestbehavior.allowget);     } 

or suggest , way. task in call controller method , wait method response in javascript.

thanks

if use jquery.ajax, you'll @ least able see error being returned server:

function gettrainingresults(id, callback) {     $.ajax({         url: "/dashboard/gettrainingresults/",         data: {id: id},         success: function(data) {             callback(data);         },         error: function(jqxhr, textstatus, errorthrown) {             console.log(errorthrown);             callback(errorthrown);         }     }); } 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -