tags:

views:

24

answers:

3
+3  A: 

Edit, for updated question: Your site appears to work for me now, be sure to clear your cache with Ctrl+F5 if you're still having issues.

Your if() check is a little off, this:

if(response.indexOf('|' != -1)) {

should be:

if(response.indexOf('|') != -1) {

currently you're getting a false positive, and the code inside that if shouldn't even be executing...but they are :)

Nick Craver
A: 

What's the value of update right before your getElementById line? Use console.log or equivalent to see if the array includes what you expect.

thenduks
Also, yes, Nick Craver noticed a syntax error -- that will need to be fixed first for sure! :)
thenduks
A: 

This means that whatever you're returning in the responseText, is not what you're wanting.

If you're returning

"updatePanel|my message"

you need something on your page like this:

<div id="updatePanel">your message will go here</div>

So check your return value by alerting or inspecting the responseText. Firebug will help you.

Nik
echo 'response|Thank you '.$name.', your email has been sent.'; //now lets update the "response" div on the contact.html page. The response| tell's the javascript which div to update.?> and on my page I have <div id="response"</div>
Dustin McCarthy
@Dustin - Is your `<div>` *exactly* like that? It's missing a closing `>` on the tag if so.
Nick Craver
<div id="response"></div> sorry
Dustin McCarthy
http://www.megabytemedia.net/test/contacts.html
Dustin McCarthy
@Dustin - Is that your *entire* response, or is the rest of the page rendering as well? Try `alert(response)`, what are you seeing?
Nick Craver
@Nick it seems to be doing nothing...
Dustin McCarthy
@Dustin - The response I'm getting is: `<br /><b>Parse error</b>: syntax error, unexpected T_ECHO in <b>/home/megabyte/public_html/test/contact.php</b> on line <b>30</b><br />`, so you're not getting a valid response back because of a PHP error.
Nick Craver
posted my contact.php
Dustin McCarthy
@Dustin - It's fixed now, not sure what you did...the `<div>` is being populated with the message, but it has ` display: none;` style rule on it you need to remove, looks like your only issue was the syntax error I posted in my answer :)
Nick Craver
not getting any errors, I removed the display rule, and still not getting it to display ?
Dustin McCarthy
@Dustin - Ctrl+F5 to completely clear your cache, it's working here.
Nick Craver