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 #170896 is a reply to message #170895] Sun, 05 December 2010 23:34 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 05/12/10 23:13, bruceaj wrote:
> 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..

I hope it's actually:

<div id='results'></div>

or:

<div id="results"></div>

and not really:

<div id='results"></div>

Rgds

Denis McMahon
[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: Fri Nov 22 10:16:05 GMT 2024

Total time taken to generate the page: 0.04321 seconds