views:

40

answers:

3

When I am adding data to the server it send me a response saying data is added whereas in case of data already exist in server i receive a message saying this data with name and description exist in the server.... how can I show my server response text ?

edit: solved

  $.ajax({
                url: "/#",
                type: "POST",   
                data: {
                    method:"a",
                    spogName:s,
                    spogDescription:spogDis
                },  
                cache: false,
                success:function(message) {
                //alert($(".success").html());},
            In this section i will have to get the response inside the jquery dialog

    if (message === 'sucess result' ) {

                            $("#dialog-message")
                              .find('.error').hide().end()
                              .find('.success').show().end()
                              .dialog({
                                resizable:false,
                                height:180,
                                modal: true,
                                buttons: {
                                  Ok: function() {
                                    $(this).dialog('close');
                                  }
                                }
                              });
                          }

                          } else {
                            // server liked it, show the success placeholder and spawn the dialog

                                      $("#dialog-message")
                              .find('.success').hide().end()
                              .find('.error').show()
                                .find('.message').text(message).end()
                                .end()
                              .dialog({
                                resizable:false,
                                height:180,
                                modal: true,
                                buttons: {
                                  Ok: function() {
                                    $(this).dialog('close');
                                  }
                                }
                              });
                },

            });
A: 
$.post("result.php", data, function(response){
  $("#targetDialog").html(response);
});
JapanPro
A: 
$.ajax({
type: "POST",
url: "/path/to/post/to",
data: "your data"
success: function (data) {
    // work with your data.
},
error: function () {
    alert('error getting data from server');
}

});

More info about jQuery AJAX

Bjarki Heiðar
check my updated question section...by the way I am using sucess
paul
A: 

this problem is solved ...described it in update

paul