How to pass a value in jQuery
I want to pass an error message. How do I do it 开发者_StackOverflow中文版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'.
"'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);
if(data.success == 0){
$.modaldialog.error(div);
??
精彩评论