|
Posted by Stut on 09/30/05 12:59
xfedex wrote:
>I did the "Rasmus' 30 second AJAX Tutorial" just for testing and everything
>works fine, by the way... thanks Rasmus, for this and for all !!.
>My little script have a single <input> and for every keystroke (calling the
>javascript function with onkeyup) the value of the input is parsed by
>another php script that just return the lenght of the string. So, if I start
>typing the word "hello", when i press the "h" key it displays 1, for "ho" it
>displays 2 and so on....very simple, just for testing.
>
>But (theres always a "but"!!) it seems that only work if I call the function
>sndReq(); with onkeyup. If I call the function from a onsubmit it
>returns...nothing!.
>Then alert('response:'+http.responseText); it's EMPTY.
>
>Im absolutely sure that the difference between the two scripts is that the
>one that works is the onkeyup, and the one that not is the onsubmit.
>
>So, anybody knows why this is happening?
>
>
What do you return from the onsubmit? If the onsubmit code evaluates to
true then the form will be submitted causing the page source to change
which would cause unpredictable results for the AJAX response depending
on several race conditions. Can I suggest you let us see the whole form
so we can see exactly what the onsubmit code does.
-Stut
[Back to original message]
|