Results 1 to 4 of 4

Thread: result is undefined

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default Answered: result is undefined

    I am trying to upload a file in extjs. I get the error result is undefined while using ext-all-debug.js And I get "a is undefined" when using ext-all.js What may be the error ? Please help..

    my code is,

    Code:
      sform.submit({
          url:'php/submit_db.php',
          method:'POST',
          waitMsg:'Uploading License',
          params:{ action:'upllic', fileid:id, reqby:by },
          //submitEmptyText:true,
          //waitTitle:'Uploading ...',
          success:function(form, action){
               var res = action.result.msg;
               Ext.getCmp('licuplpanel').close();
               Ext.Msg.show({
                  title:'Success',
                  msg:res,
                  icon:Ext.Msg.INFO,
                  buttons:Ext.Msg.OK
               });
               store_product_history.load();
          },
          failure:function(form, action){
            var res = action.result.errors;
            Ext.getCmp('licuplpanel').close();
            Ext.Msg.show({
              title:'Error',
              msg:res,
              icon:Ext.Msg.ERROR,
              buttons:Ext.Msg.OK
            });
           }
      });

    My server side code is,

    Code:
     $result = array();
     $result['success'] = true;
     $result['msg'] = $code;
     echo json_encode($result);
     exit(0);
    upload_error.jpeg
    Last edited by gameboy87; 20 Mar 2013 at 2:48 AM. Reason: For uploading image file

  2. Hey ! I found out. Inside the PHP file I use a require_once statement for referring a file. In that bottom of the referred file, it had exit(0) statement. When I removed the statement it got executed. Thanks icemanovich for giving me a clue.

    Quote Originally Posted by icemanovich View Post
    May be you should use return instead of exit(0) in PHP code. Because exit() - Output a message and terminate the current script and you will have invalid JSON in Js.

  3. #2
    Sencha User
    Join Date
    Jun 2011
    Location
    Russia
    Posts
    39

    Default

    May be you should use return instead of exit(0) in PHP code. Because exit() - Output a message and terminate the current script and you will have invalid JSON in Js.

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default

    That didn't solve my problem. Some other solution ?

  5. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default

    Hey ! I found out. Inside the PHP file I use a require_once statement for referring a file. In that bottom of the referred file, it had exit(0) statement. When I removed the statement it got executed. Thanks icemanovich for giving me a clue.

    Quote Originally Posted by icemanovich View Post
    May be you should use return instead of exit(0) in PHP code. Because exit() - Output a message and terminate the current script and you will have invalid JSON in Js.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •