EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: marc on May 21, 2013, 12:30:10 PM



Title: Error in save function
Post by: marc on May 21, 2013, 12:30:10 PM
Please help, I cant able to save or update any data.
And when I check my firebug console its pointing me on the saveUser function.
Please see the text in yellow.

function saveUser(){
         $('#fm').form('submit',{
            url: url,
            onSubmit: function(){
               return $(this).form('validate');
            },
            success: function(result){
               var result = eval('('+result+')');
               if (result.success){
                  $('#dlg').dialog('close');      // close the dialog
                  $('#dg').datagrid('reload');   // reload the user data
               } else {
                  $.messager.show({
                     title: 'Error',
                     msg: result.msg
                  });
               }
            }
         });
      }


Title: Re: Error in save function
Post by: hjzhbb7758 on May 22, 2013, 01:59:07 AM
Your console output what?


Title: Re: Error in save function
Post by: marc on May 22, 2013, 11:49:15 AM
Quote
SyntaxError: syntax error
[Break On This Error]    

(<br>

(line 55, col 1)

Thats what my console said.
Please help
   


Title: Re: Error in save function
Post by: Kevin on June 05, 2013, 01:42:44 AM
Hi Marc

Check what is being returned in your JSON. This is the issue with eval. For example, the following will generate an error;
eval("x=10;y=20;document.writ(x*y)");

This is because of a spelling mistake in the method 'write'.