-
Help with ajax basic routine
I am having problems using the basic script:
http://www.dynamicdrive.com/dynamici...jaxroutine.htm
my code is like this:
function DoSave() {
var parms = "ActionType=Save";
var f = document.frmEdit;
ajaxpack.getAjaxRequest("save.jsp", parms, processGetPost, "txt");
//ajaxpack.postAjaxRequest("save.jsp", parms, processGetPost, "txt"); }
function processGetPost() {
var myajax = ajaxpack.ajaxobj;
var myfiletype = ajaxpack.filetype;
if (myajax.readyState == 4) {
if (myajax.status == 200 || window.location.href.indexOf("http") == -1) {
if (myfiletype == "txt")
alert(myajax.responseText);
else
alert(myajax.responseXML);
}
}
}
save.jsp
<%
String actionType = request.getParameter("ActionType");
out.print(actionType);
%>
when I use getAjaxRequest,it return a "null" to me, while use postAjaxRequest, it delays 2-3 minutes to return me a "Save" string, --that's correct result.
The question is ,
1, why cannot I get a correct result from getAjaxRequest?
2, why do postAjaxRequest need so much time in return a simple value?
thanks.
-
-
seems some wrong in parameters, when put url and parameter together in getAjaxRequest("GET",url+"?"+parameters,"","txt"), I can get correct result.
-
-
Just to confirm then, are you still having problems with this script? The long delay btw can only be due to something on your backend taking its time to return the data.
-
-
Not settle for postAjaxRequest. I use Tomcat5.5 jsp/servlet environment. My worry is that if I submit a set of data more than 1k, the "GET" method cannot handle it. Is that right?
thank you.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks