ajax success method not showing data in asp.net mvc -
i working on asp.net application. view has button this:
<input type="button" id="btncall" title="call" value="call" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
and in document.ready, have this:
$("#btncall").click(function () { alert("here"); $.ajax({ type: "post", datatype: "text/json", url: "/account/getgenericpassword", success: function (data) { alert("data" + data); if (data == null || info == "") { alert("generic password empty. please come in generic password"); } else { //savecallrecording(); } } }); });
and method this:
[authorize] public jsonresult getgenericpassword() { using (iuserprofilemanager profilemanager = new managerfactory().getuserprofilemanager()) { userprofile profile = profilemanager.getprofile(currentuser.id, currentaccount.id); homecoming json(profile.genericpassword == null ? "" : profile.genericpassword, jsonrequestbehavior.allowget); } }
but alert in success not shown. please suggest solution.
try setting datatype so:
datatype: "json"
see valid datatype options @ http://api.jquery.com/jquery.ajax/
ajax asp.net-mvc jquery asp.net-mvc-2
No comments:
Post a Comment