title: I am enable to get the success message..!
body: <p>i am trying to get the user details into database and data is stored..i want a success message to fade in i have tried out some code but sadly its not working...plzz help me out of this..beg u pardon if am wrong..
                      here gose my <strong>register.php</strong> code</p>
  
  <pre><code>               &lt;?php
      require_once 'DB_Functions.php';
      $db = new DB_Functions();
  
      // json response array
      $response = array("error" =&gt; false);
      if (!empty($_POST['fname']) &amp;&amp; !empty($_POST['lname']) &amp;&amp; !empty($_POST['email']) &amp;&amp; !empty($_POST['password']) &amp;&amp; !empty($_POST['mobile'])){
          // receiving the post params
          $fname = trim($_POST['fname']);
          $lname = trim($_POST['lname']);
          $email = trim($_POST['email']);
          $password = $_POST['password'];
          $mobile = trim($_POST['mobile']);
  
          // validate your email address
          if(filter_var($email, FILTER_VALIDATE_EMAIL)) {
              // valid email address
              if ($db-&gt;isUserExisted($email)) {
                  // user already existed
                  $response["error"] = true;
                  $response["error_msg"] = "User already existed with " . $email;
                  echo json_encode($response);
              } else {
                  // create a new user
                  $user = $db-&gt;storeUser($fname, $lname, $email, $password, $mobile);
                  if ($user) {
                      // user stored successfully
                      $response["error"] = false;
                      $response["uid"] = $user["id"];
                      $response["user"]["fname"] = $user["fname"];
                      $response["user"]["lname"] = $user["lname"];
                      $response["user"]["email"] = $user["email"];
                      $response["user"]["created_at"] = $user["created_at"];
                      $response["user"]["updated_at"] = $user["updated_at"];
                      echo json_encode($response);
                  } else {
                      // user failed to store
                      $response["error"] = true;
                      $response["error_msg"] = "Unknown error occurred in registration!";
                      echo json_encode($response);
                  }
              }
          } else {
              // invalid email address
              $response["error"] = true;
              $response["error_msg"] = "invalid email address";
              echo json_encode($response);
          }
      } else {
          $response["error"] = true;
          $response["error_msg"] = "Required parameters are missing!";
          echo json_encode($response);
      }
  ?&gt;
  </code></pre>
  
  <p>and here gose the <strong>.html</strong> file with jquery..</p>
  
  <pre><code>              &lt;html&gt;
      &lt;head&gt;
  &lt;title&gt;jQuery Test&lt;/title&gt;
  &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src = "register.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
  
   &lt;body&gt;
  
      &lt;!--html body--&gt;
      &lt;form name = "register" id = "register" method = "POST"&gt;
          &lt;label&gt;First name:&lt;/label&gt;
          &lt;input type = text name = "fname" id = "fname" required&gt;
          &lt;label&gt;Last name:&lt;/label&gt;
          &lt;input type = "text" name = "lname" id = "lname" required&gt;
          &lt;label&gt;E-mail:&lt;/label&gt;
          &lt;input type = "email" name = "email" id = "email" required&gt;
          &lt;label&gt;Password&lt;/label&gt;
          &lt;input type = "password" name = "password" id = "password" required&gt;
          &lt;label&gt;Mobile no:&lt;/label&gt;
          &lt;input type = "number" name = "mobile" id = "mobile" required&gt;
          &lt;input type="submit" value="Insert" name="submit" id = "submit"&gt;
      &lt;/form&gt;
      &lt;div id = "result" align = "right"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>here gose me /<em>.js</em>/ file</p>
  
  <pre><code>        $(document).ready(function(){
  
      $("#submit").click(function(e){
  
          e.preventDefault();
  
          $.ajax({
              url: "register.php",
              type: "POST",
              data: {
                  fname: $("#fname").val(),
                  lname: $("#lname").val(),
                  email: $("#email").val(),
                  password: $("#password").val(),
                  mobile: $("#mobile").val()
              },
              dataType: "JSON",
              success: function (json) {
                  $("#result").html(json.user.email);  // like that you can display anything inside #result div
                  $("#result").fadeOut(1500);
  
              },
              error: function(jqXHR, textStatus, errorThrown){
                  alert(errorThrown);
              }
          });
      });
  
  }); 
  </code></pre>