javascript - Ajax Appending To End Of Current URL Rather Than Provided File Name [Solved] -



javascript - Ajax Appending To End Of Current URL Rather Than Provided File Name [Solved] -

the problem i'm having ajax appending variables end of current url. need point prohost.php.

i was/am using tutorial here tutorial

the way have working onsubmit="return validateinput(); form validates input calls function ajaxfunction() send info php file prohost.php

however right ajax this

newhost.php?fname=d&lname=d&email=samesc%40yahoo.com&birthdate=2014-06-8&pass=s&passre=s

when should

prohost.php?fname=d&lname=d&email=samesc%40yahoo.com&birthdate=2014-06-18&pass=s&passre=s

if edit url myself (prohost.php?fname=d&lname=... ) php file reports should plain text on empty page.

here html form:

<form action="" method ="get" onsubmit="return validateinput(); " > <p id="demo" style="text-align: center">&hellip;</p> first name: <input id="fname" name="fname" type="text" required placeholder="john" size="35" value="d" > lastly name: <input id="lname" name="lname" type="text" required placeholder="smith" size="35" value="d"> email: <input id="email" name="email" type="email" required placeholder="john@smith.com" size="35" > birth date: <input id="birthdate" name="birthdate" type="date" required min="1900-01-01" > password: <<input id="pass" name="pass" type="password" required size="35" placeholder="secret" > retype password: <input id="passre" name="passre" type="password" required size="35" placeholder="secret" > <input type="reset" class="button" value="clear" name="resetbtn"> <input type="submit" class="button" value="submit"> <input id="clickme" type="button" value="clickme" onclick="dofunction();" /> </form>

and here script:

<script language="javascript" type="text/javascript"> function ajaxfunction(){ var ajaxrequest; // variable makes ajax possible! try{ // opera 8.0+, firefox, safari ajaxrequest = new xmlhttprequest(); }catch (e){ // net explorer browsers try{ ajaxrequest = new activexobject("msxml2.xmlhttp"); }catch (e) { try{ ajaxrequest = new activexobject("microsoft.xmlhttp"); }catch (e){ // went wrong alert("your browser broke! please utilize current web browser"); homecoming false; } } } // create function receive info // sent server , update // div section in same page. ajaxrequest.onreadystatechange = function(){ if(ajaxrequest.readystate == 4){ var ajaxdisplay = document.getelementbyid('demo'); ajaxdisplay.innerhtml = ajaxrequest.responsetext; } } // value user , pass // server script. //mine var fname = document.getelementbyid("fname").value; var lname = document.getelementbyid("lname").value; var birthdate = document.getelementbyid("birthdate").value; var email = document.getelementbyid("email").value; var pass = document.getelementbyid("pass").value; var querystring = "?fname=" + fname + "&lanme=" + lname + "&birthdate=" + birthdate + "&email=" + email + "&pass=" + pass; ajaxrequest.open("get", "prohost.php" + querystring, true); ajaxrequest.send(null); homecoming false }

try alter line:

ajaxrequest.open("get", "prohost.php" + querystring, true);

to this:

ajaxrequest.open("get", "/prohost.php" + querystring, true);

with /

javascript php html ajax

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -