Wednesday, March 26, 2014

How to send ajax request ??                                                                                                        

 var variable=$("#id").val();
 $.ajax({
             type: "POST",
             url: "myphp.php",
             data: "variable="+variable;        
 success: function(html){
               if(html=='true')
               {
                 alert(html);
                
               }
               else
               {
                     $("#error_id").html("Wrong username or password");
               }
             },
             beforeSend:function()
             {
                  $("#error_id").html("Loading...")
             }
         });

No comments:

Post a Comment