Results 1 to 4 of 4

Thread: Help with ajax basic routine

  1. #1
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy 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.

  2. #2
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    seems some wrong in parameters, when put url and parameter together in getAjaxRequest("GET",url+"?"+parameters,"","txt"), I can get correct result.

  3. #3
    Join Date
    Aug 2004
    Posts
    9,890
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    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.

  4. #4
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •