Results 1 to 7 of 7

Thread: Ext Direct with PHP and MySQL

  1. #1
    Sencha User
    Join Date
    Jun 2017
    Posts
    10
    Vote Rating
    0
      0  

    Default Ext Direct with PHP and MySQL

    I try to create example extjs app using thishttps://docs.sencha.com/extjs/6.5.1/...mysql_php.html guide. And I still getting this error:

    Przechwytywanie1.PNG

    'Invalid request' is from line 29 in router.php, but I can figured out why it cant find extAction.


    Code:
    if (isset($HTTP_RAW_POST_DATA)) {
        header('Content-Type: text/javascript');
        $data = json_decode($HTTP_RAW_POST_DATA);
    }
    else if(isset($_POST['extAction'])){ // form post
    $isForm = true;
        $isUpload = $_POST['extUpload'] == 'true';
        $data = new BogusAction();
        $data->action = $_POST['extAction'];
        $data->method = $_POST['extMethod'];
        $data->tid = isset($_POST['extTID']) ? $_POST['extTID'] : null;
        $data->data = array($_POST, $_FILES);
    }
    else {
        die('Invalid request.');
    }



  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506
    Vote Rating
    291
      0  

    Default

    Looks like your JSON might be invalid. What does it look like?

  3. #3
    Sencha User
    Join Date
    Jun 2017
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Gary Schlosberg View Post
    Looks like your JSON might be invalid. What does it look like?
    You mean what's in $response witch on the end of router.php?
    echo json_encode($response);
    Or something else?

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      0  

    Default

    You need to look at the network tab of the browser developer tools and look at what is being returned. Ext JS is even telling you what was returned by the error that is presented. It's saying PHP is returning the error:

    Notice: Undefined index: extAction in E:\web\htdocs\DirectApp\php\router.php on line 14
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Jun 2017
    Posts
    10
    Vote Rating
    0
      0  

    Default

    But router.php shows nothing in response


    Przechwytywanie.jpg

  6. #6
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      0  

    Default

    First, you should be returning JSON if invalid to signify a failure for Direct to consume. Is that the right request to router.php and/or were some other changes made to your backend?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  7. #7
    Sencha User
    Join Date
    Jun 2017
    Posts
    10
    Vote Rating
    0
      0  

    Default

    I'm not sure if it is what you want to check but I try to return $HTTP_RAW_POST_DATA and get this

    Przechwytywanie1.jpg

    same response when I try with $_POST['extAction'])

    and then just serialize($_POST)

    Przechwytywanie2.PNG

    so router didn't get any of information it can expect and use?

Similar Threads

  1. Replies: 5
    Last Post: 10 Dec 2015, 12:36 PM
  2. Replies: 3
    Last Post: 28 Sep 2012, 2:01 PM
  3. Ext.Direct in connecting to PHP/MySQL
    By JNiles in forum Ext.Direct
    Replies: 0
    Last Post: 26 Jan 2012, 5:21 AM
  4. Simple Ext.Direct-Combobox plugin --- with Ext.Direct.Store for reuse
    By xp743 in forum Ext 3.x: User Extensions and Plugins
    Replies: 1
    Last Post: 26 Jul 2010, 11:56 AM
  5. Example php mysql
    By waxx in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 9 Jul 2009, 6:26 AM

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
  •