Wrox Programmer Forums
|
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
 
Old July 4th, 2007, 06:39 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

 
Old July 4th, 2007, 07:55 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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/
 
Old July 4th, 2007, 08:06 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 ???
 
Old July 4th, 2007, 08:11 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old July 4th, 2007, 10:21 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old July 5th, 2007, 09:51 PM
Registered User
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 ! ;)





Similar Threads
Thread Thread Starter Forum Replies Last Post
XmlHttp Request??? firebirdjohn61 Ajax 11 June 4th, 2007 01:11 PM
post xml using xmlhttp in vb.net datakix VB.NET 3 December 21st, 2004 01:31 PM
Problem with using POST method with XMLHTTP vvr Classic ASP XML 1 December 6th, 2004 01:44 AM
XML Post using microsoft.XMLHTTP csmajor231 XML 0 April 5th, 2004 03:06 PM
Using XMLHTTP to POST form data channer Classic ASP XML 8 January 6th, 2004 05:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.