jim
jim

Reputation: 1

How to pass a value in jQuery

I want to pass an error message. How do I do it and what do I need to change?

    success: function(data) {
      var div = $('<div>').attr('id', 'message').html(data.message);
      if (data.success == 0) {
        $.modaldialog.error('The operation failed.');

        ...

I want to replace the div with the error message that comes into this success function. I still need the id though I think because it is what toggles between the success and error block.


'The operation failed.' should be replaced with the error message that is contained in 'data.message'.

Upvotes: 0

Views: 200

Answers (2)

Jeff
Jeff

Reputation: 4146

"'The operation failed.' should be replaced with the error message that is contained in 'data.message'"

 success: function(data){
    var div = $('<div>').attr('id', 'message').html(data.message);
    if(data.success == 0){
      $.modaldialog.error(data.message);

Upvotes: 1

DrStrangeLove
DrStrangeLove

Reputation: 11557

if(data.success == 0){
          $.modaldialog.error(div);

??

Upvotes: 0

Related Questions