javascript - jQuery post method parameter passing fail -
i new javascript , learning post method. wrote code, doesn't work , can't figure out why.
here script code:
<script> $(document).ready(function () { $.post("/api/totaluserexp", { startdate: '20150701', enddate: '20150701' }, function (data) { document.write("total experience: " + data); }, 'json'); }); </script> here script code, should same thing:
<script> $(document).ready(function () { $.post("/api/totaluserexp", { startdate: "20150701", enddate: "20150701" }) .done(function (data) { $(".result").html("total experience: " + data); }); }); </script> both of them returns empty page no errors, no warnings etc. when use alert, nothing happens.
here controller:
public int post(datetime startdate, datetime enddate) { return dbclasspackage.izamanraporlama.getusertotalexp(startdate, enddate); }
set variable in controller debug input data , output result.
public int post(datetime startdate, datetime enddate) { int result = dbclasspackage.izamanraporlama.getusertotalexp(startdate, enddate); return result; }
Comments
Post a Comment