asp.net mvc 3 - Insert Javascript Function Value in Partial View -
i have javascript function returns value trying display in table in partial view.
in main view have this:
<script type="text/javascript"> function myfunc(i) { var url = '/myurl/?id=' + i; $.getjson(url) .done(function (data) { return data; } } </script> in partial view html trying this:
<td><script>document.write(myfunc())</script></td> the function gets called seems return undefined doing wrong here?
this because not passing parameter in function , function aspect parameter.. null @ stage.
your call ...
document.write(myfunc())and function
function myfunc(i)so url become
var url = '/myurl/?id=' + null; // thing this
so url not correct , hence not getting correct data
Comments
Post a Comment