Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 4th, 2007, 07:39 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old July 4th, 2007, 08:55 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
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/
Reply With Quote
  #3 (permalink)  
Old July 4th, 2007, 09:06 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
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 ???
Reply With Quote
  #4 (permalink)  
Old July 4th, 2007, 09:11 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
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.

Reply With Quote
  #5 (permalink)  
Old July 4th, 2007, 11:21 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
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.
Reply With Quote
  #6 (permalink)  
Old July 5th, 2007, 10:51 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
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 ! ;)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XmlHttp Request??? firebirdjohn61 Ajax 11 June 4th, 2007 02: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 04:06 PM
Using XMLHTTP to POST form data channer Classic ASP XML 8 January 6th, 2004 05:44 AM



All times are GMT -4. The time now is 10:22 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.