jquery - $.getJSON is not fully working -


i have simple java-script method call code behind using $.getjson.

 function gettrainingresults(id){  $.getjson("/dashboard/gettrainingresults/", null, function(data) {    return data;    }); } 

and conroller method

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

its being called. cant data.it returns null. note : how pass paremeter.

thanks

you have use callback return value ajax request.

something :

function gettrainingresults(id, callback){    $.getjson("/dashboard/gettrainingresults/", null, callback); } 

call example :

gettrainingresults(yourid, function(data) { alert(data); }); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -