FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP/AJAX Problem
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP/AJAX Problem [message #170895 is a reply to message #170841] Sun, 05 December 2010 23:13 Go to previous messageGo to previous message
bruceaj is currently offline  bruceaj
Messages: 30
Registered: September 2010
Karma:
Member
On Dec 1, 10:08 am, Helmut Chang <use...@helmutchang.at> wrote:
> Am 01.12.2010 01:26, schrieb bruceaj:
>
>> Here is my Code. This is the call from my main routine
>
>> <input name="btnSearch" type="submit" id="btnSearch"
>> onclick="getData('results')", value="Submit Search" />
>
>                                ^
>                                Is this a typo?
>
> As others already wrote: Here you have a submit button. So it does two
>
> things, when clicked:
>
> Calls the JavaScript function
> *and*
> submits the form (if it's within a form).
>
> That triggers two requests, where I guess, the response of the
> form-submit "overwrites" the response from the AJAX call.
>
> Solution: either use a <input type="button" />, which wouldn't submit
> the form. Or use your submit-button and return false from the click
> handler to suppress the submitting of the form. But this makes only
> sense, if you want a fallback in submitting the form, if JavaScript is
> turned off or your JavaScript functions return a correct true or false,
> depending whether the call succeeded or not.
>
>> <div id-'results'></div>
>
>           ^
> Is this a typo? With this, I don't think, you would have an element with
> the id "results".
>
> Helmut

I changed the button to a type button and all works fine

As of <div id='results"></div>, this is the target for my innerHTML
AJAX response..

Thanks...

Bruce
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: return value?
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 12:53:59 GMT 2024

Total time taken to generate the page: 0.04522 seconds