santa santa - 2 years ago 78
Javascript Question

How to test AJAX post with jQuery

I have the following function that opens jQuery UI's dialog warning about the delete of an entry. Everything works fine, except the POST with AJAX. I get response on "success" but I don't believe I am hitting the .php page that is supposed to execute the query. Am I missing anything here?

var $dialog = $("#dialog").dialog({ autoOpen: false, resizable: false, modal: true });

var delURL = $(this).attr("href").split("#");
var projID = delURL[1];
buttons: {
"Yes, delete this test": function() {
type: "POST",
url: "",
data: "op=DeleteProject&delete="+projID,
success: function(){
// alert( "Test Project deleted successfully." );
"No, keep it.": function() {

Answer Source

Make your php page called echo something


echo 'hello world';


Add the return value of the callback (here data), and try to show it with js.


success: function(data){


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download