AJAX query using jQuery and PHP POST method is not working -


below html form part

<form name="messagebox" action="" onsubmit="return false">     <input type="text" name="newmessage" size="80" value="" />     <input type="submit" class="sendmessage" value="send" /> </form> 

below portion of javascript file containing jquery's ajax api. have tested php file in question independently , php file works. , javascript call pasted below works until 'alert(datastring)' problem ajax query. don't understand why isn't working copying structure of script have used on working website before. testing in xampp i'm not sure if maybe xampp server problem, highly doubt it.

$(function() {     $(".sendmessage").click(function() {         var guestid = $(".username a").html();          var messagecontent = document.messagebox.newmessage.value;          var dateobj = new date();         var messagetime = dateobj.gettime();            var datastring = 'username=' + guestid + '&messagecontent=' + messagecontent + '&messagetime=' + messagetime;          $.ajax({             type: "post",             url: "send_message.php",             data: datastring,             success: function () {                 alert('success');             }         });     }); }); 


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

binding - How can you make the color of elements of a WPF DrawingImage dynamic? -

c# - How to add a new treeview at the selected node? -