|
BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6
| This is the forum to discuss the Wrox book Professional Ajax, 2nd Edition by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780470109496 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
July 4th, 2007, 06:39 PM
|
Registered User
|
|
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Request Post XMLHttp : Need Help
Hello guys,
first of all sorry if I explain myself badly but I am not a Shakesperean Native ;).
Ok here it is :
Chapiter 2 of the Book :
I am trying to use a Post Form in ajax, it works well, untill I include it with other files.
Let me explain better :
I got SaveCustomer.php plus and the XMLHttpExample2.htm (this one with the POST).
All together they work fine.
But when I try to include the XMLHttpExample2.htm with header.php and footer.php in a common php file, when I try it without giving my name for example it take the header + the htm file + the footer inside the DivStatus <div>, what can I do to show only an error message ???
I could show you if you need to see what happen in a screenshot, the prob is that I think it get the <body></body> and print it instead of giving only the error message !!!
Any help please :).
Thanks guys.
P.S : I luv your Book btw.
|
July 4th, 2007, 07:55 PM
|
|
Wrox Author
|
|
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Without knowing exactly what you're doing or what the exact error is, it's hard to know why you're having trouble. My hunch is that including these various files using one PHP creates an invalid HTML file (perhaps having two sets of <html> and <body> tags), which confuses the JavaScript. View the source of the page when you load it in the browser and see if you notice any problems with the HTML. If you can be sure that the HTML is valid, your errors will probably go away.
Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
|
July 4th, 2007, 08:06 PM
|
Registered User
|
|
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey,
I think i found the error, the prob is that it in the menu.inc.php there is another form, is there a way to identify each ones ???
Because with 2 forms the code doesn't work, is it possible to name the form for example <form name="ins" ...> and to indicate to the script that you have to get values from the form named ins ???
|
July 4th, 2007, 08:11 PM
|
Registered User
|
|
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Lol, I made it in the function in the js script :
i changed it : var oForm = document.forms["0"];
to : var oForm = document.forms["oForm"];
And it works perfectly, even if there is another form in the page.
Sorry, I answered myself hehe.
I made it step by step, including and deleting each part of my template lol.
Thanks anyway.
|
July 4th, 2007, 10:21 PM
|
Registered User
|
|
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok guys, I insert a Checkbox in the form but, when i try to see if it is set in SaveCustomer it's says it always set
this is the checkbox in the html form :
<input type="checkbox" name="case" value="y" onfocus="blur()" />
and this is the code in the savecustomer.php :
$case = $_POST["case"];
if (isset($case))
echo "OK";
The prob, is that it print OK even if it isn't sticked ?!?
Any suggestions ???
Thanks for the help.
|
July 5th, 2007, 09:51 PM
|
Registered User
|
|
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I went to your website Nicholas C. Zakas and it works nice now, I downloaded the files inside your website, had a lot more in your javascript code.
So, after all I went to your Speaking, and for this I appreciate a lot the comments you put on your code.
Your code is really really really nice, and really maintainable, I understood everything, and got pleasure to read it.
It's clear, nicely commented, and understandable.
Thanks again sir ! ;)
|
|
|