javascript - unable to send ajax request on php -


I am using an AJAX request to send to php. In the form method, I am using the following code.

rohit1.php

  & lt; Form action = "index1.php" onsubmit = "callfunc ()" & gt; & Lt; Span id = "raj" & gt; & Lt; / Span & gt; & Lt; Input type = "submit" value = "submit" & gt; & Lt; / Div & gt; & Lt; / Form & gt;   

In JavaScript, I am using: callfun.js

  function callfunc () {var http = new XMLHttpRequest (); Var Name = Prompt ('Enter the name of the form'); Var Name = "Rohit"; Var url = "index1.php"; Var s = document.getElementById ('raj'). InnerHTML; Warning (http); Http.open ("POST", "index1.php? Name =" + name, true); Http.onreadystatechange = function {if (http.readyState == 4 & amp; http.status == 200} {}} http.send ();}   

When I Function, then submitting it is redirecting to index.php? Label = on the name of index.php? Name = what should I do for it ???

just try to add return false at the end of the callfunk () function. Will stop the default event and will not function as a standard form. < / Div>

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -