如何删除undefined?

时间:2015-03-20 05:42:44

标签: javascript ajax jquery-ui spring-mvc

当我在表中添加新规则时,它显示“未定义”。但是在jsp的控制器中它返回正确的值。如果我在alert中打印值,则会打印确切的值。但唯一的问题是它显示“未定义”。刷新页面后,它显示正确的值。

我也给了表刷新。但我不知道它为什么显示未定义。请帮帮我怎么解决这个问题?

var ajaxObj = {
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    type: "POST",
    async: false,
    beforeSend: function (jqXHR, settings) { 
    $.blockUI({ message: '<h1><font size="2" >Please wait...</font></h1>'  });
    jQuery('.ui-dialog-titlebar-close').trigger('click');
  }
   }; 
    					
    $.ajax($.extend({}, ajaxObj, {
    url: "draftPoolRulesAdd", 
    data: JSON.stringify(data),
    success: function () {
    			        	
    $( "#poolrules_tab_main" ).pqGrid( "addRow", { rowData: {"poolRuleId":ruleId,"poolruleSeq":1,"poolRuleName":ruleName,"poolRuleComment":comments,"poolruleCondition":a.toString(),
 "poolruleValue":b.toString(),"poolruleDataType":'Y',"poolruleAddPoints":c.toString()} } );
      
    alert("pool rule name" + ruleName);		
      
    if(AdditionalPoolPoints ()){
    $.unblockUI();
    			    			
    $('div.jGrowl').find('div.jGrowl-notification').parent().remove(); 
   $.jGrowl("Rule was successfully Added", {  life:1500 });
    $.jGrowl.defaults.pool = 1;
    $("#poolrules_tab_main").pqGrid("refreshDataAndView");
   }
     }
   }));

在成功功能中,我正在打印一个警报。这里是打印确切的池规则名称。但在屏幕上只显示“未定义”。请帮助我。

0 个答案:

没有答案