formulaire

formulaire

Hello dear friends developer,

         I am a new developer jquery mobile, I have a problem with the code below, given that when I filled out the form (index.html) and send it to (action.php) I output which displays the code of second file (action.php).

Fichier index.html

 

<!DOCTYPE html> 

<html> 

<head> 

  <meta name=viewport content="user-scalable=no,width=device-width" />

  <link rel=stylesheet href=jquery.mobile/jquery.mobile.css />

  <script src=jquery.js></script>

  <script src=jquery.mobile/jquery.mobile.js></script>

</head> 

    <body>

<div data-role=page id=home>

  <div data-role=header>

    <h1>Home</h1>

  </div>

  <div data-role=content>

    <p> Window content </p>

    Name : <input type=text /> <br />

  </div>

</div>

</body>

</html>

<script>

 

$("input").bind ("change", function (event)

{

  var name = $(this).val ();

  $.ajax (

  {

   url : "action.php",

    data : { name : name },

    complete : function (xhr, result)

 

    {

      if (result != "success") return;

      var response = xhr.responseText;

     $("#home div:jqmData(role=content)").append (response);

    }

  });  

});

</script>

Fichier action.php

<?

$name = $_REQUEST["name"];

echo utf8_encode ("<p> The name entered is $name </p>");

?>