Page 2 of 2

Re: AJAX to PHP

Posted: Sat May 09, 2009 3:58 pm
by manRay
I updated the request string.

Code: Select all

 
XMLHttpRequestObject.send(fname= document.form1.fname.value & lname= document.form1.lname.value & password= document.form1.password.value & password2= document.form1.password2.value & email= document.form1.email.value & email2= document.form1.email2.value & operating= document.form1.os.value & agree= document.form1.agree.checked);
 
But dreamweaver is saying there is a syntax error. What could it be?

Re: AJAX to PHP

Posted: Sun May 10, 2009 5:05 am
by jazz090
u need to enclose the text with quotes and the vars with a +

Re: AJAX to PHP

Posted: Sun May 10, 2009 5:28 am
by manRay
I did what you said and there is still a syntax error.

Code: Select all

 
XMLHttpRequestObject.send(fname=+"document.form1.elements['first'].value"&lname= +"document.form1.elements['last'].value"&password= +"document.form1.elements['pass'].value"&password2= +"document.form1.elements['pass2'].value"&email= +"document.form1.elements['mail'].value"&email2= +"document.form1.elements['mail2'].value"&operating= +"document.form1.elements['os'].value"&agree= +"document.form1.elements['agree'].checked");
 

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:15 am
by jazz090
do not put these in quotes document.form1.elements['first'].value these are variables and not strings but the rest in quotes. also i think you should use DOM instead of refering to form objects. just give each feild an id attribute and define it in JS

Code: Select all

<input type="text" id="name_feild" />

Code: Select all

var nameFeild = document.getElementByID("name_feild")
now access it by

Code: Select all

nameFeild.value
make sure you run that code after the input tag has been specified otherwise it will be undefined at start of the script.

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:26 am
by manRay
I did what you said, although there is no error, the php page does nothing now.

Code: Select all

var fnameField= document.getElementById('first');
var lnameField= document.getElementById('last');
var passwordField= document.getElementById('pass');
var password2Field= document.getElementById('pass2')
var emailField= document.getElementById('mail');
var email2Field= document.getElementById('mail2');
var operatingField= document.getElementById('os');
var agreeField= document.getElementById('agree');
         
XMLHttpRequestObject.send("fname="+fnameField.value&"lname=" +lnameField.value&"password=" +passwordField.value&"password2=" +password2Field.value&"email=" +emailField.value&"email2=" +email2Field.value&"operating=" +agreeField.value);

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:29 am
by jazz090
ok i just realised ow many errors your script has, give me a minute to tell you what to do, im just typing up some code

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:30 am
by manRay
I appreciate it Thanks!

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:33 am
by jazz090
actualy its gonna take a lotta time and you know this isnt free. what i can tell you however is the fact that your ajax script is completly wrong, the method you are sending your vars could not be more wrong. also if your testing that with firefox, it would not work. i suggest you look at some tutorials in sending ajax scripts

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:49 am
by manRay
Of course this is free! Thanks for the help111

Re: AJAX to PHP

Posted: Sun May 10, 2009 6:52 am
by jazz090
what do you want me to write the ENTIRE script for you?