javascript - AJAX call not working in jQGrid -
i trying ajax call inside
beforeselectrow
event of grid :
beforeselectrow: function(rowid, e) { $.ajax({ url: "gridedit.jsp", datatype: "json", async: true, cache: false, type:"get", data: { before:'row', }, success: function(data, status) { alert(data); } }); return true; }
here gridedit.jsp :
<% string b=request.getparameter("before"); if(b.equalsignorecase("row")) { system.out.println("row row row boat"); out.println("bummer"); } %>
i dont error messages. want access data sent gridedit.jsp thats why trying pop alert see whether data being passed or not. when check apache tomcat logs, "row row row boat" string gets printed. not see alert when select row.
please help
thanks
edit:
here tried
$.ajax({ url: "gridedit.jsp", async: true, cache: false, type:"get", data: { before:'row', }, error: function(msg) { alert(msg); }, complete: function (xhr, status) { alert('complete: '+status); } });
i 2 alerts, first 1 says
[object][object]
and second 1 says
error
can figure out whats going on ?
please help
thanks
errors;
so here tried
$.ajax({ url: "gridedit.jsp", //datatype: "json", async: true, cache: false, type:"get", data: { before:'row' }, error: function( jqxhr, textstatus, errorthrown ) { alert(jqxhr); alert(textstatus); alert(errorthrown);}, complete: function (xhr, status) { alert('jqxhr:'+xhr); alert('complete: '+status); } });
i following alerts in order:
jqxhr: [object][object]
teststatus:
parseerror
errorthrown:
unexpected end of input
can please me in solving ? gridedit.jsp this->
<%string b=request.getparameter("before"); system.out.println("b here !" + b); out.println("hello");%>
please help
thanks
your json may not formatted properly. try returning quoted string, such "\"row row row boat\""
.
Comments
Post a Comment