1. #1
    Ext User
    Join Date
    Sep 2009
    Posts
    2
    Vote Rating
    0
    RobertoMG is on a distinguished road

      0  

    Exclamation Correct the error of using EVAL () in AIR

    Correct the error of using EVAL () in AIR


    hello friends,
    I want to know how I can do to correct this mistakes as it is very important to me, I tell you what I'm trying to do:

    First I have a system in Adobe AIR, and everything works fine, but I want to do is that in a PHP page prints I say alert ('HELLO');
    and the application I want to execute a function that returns me is what the AJAX, as shown below:

    Code:
    Ext.Ajax.request({ url:'http://127.0.0.1/test.php', method:'POST', autoLoad:true,
         params:{ pUsu:String('pUsu'), pPsw:String('pPsw') }, evalScripts:true,
         success:function(result,request){ eval(result.responseText); },
         failure:function(result,request){ air.trace('Failure'); }
    });


    then if you look where I have the eval is that what it should return the AJAX run:
    This bone
    Code:
    eval (result.responseText);
    all I have in the test.php page is:
    PHP Code:
    <?php
    echo("

        alert('Hola ... !!!');

    "
    );
    ?>
    por me da un error que es:
    Error: Adobe AIR runtime security violation for JavaScript code in the application security sandbox (eval)


    if anyone knows how to correct this error and they would appreciate a lot, and it is very important for me to do that because I need to run functions that come from the pages of php

  2. #2
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    I have to disappoint you. It's not possible to use eval() inside/after Ext.onReady.

    Define the functions in JavaScript and return the parameters you need. Preferably in JSON.

    So
    Code:
    success: function(response) {
    	var r = Ext.decode(response.responseText);
    	alert(r.myAlertText);
    }
    PHP Code:
    echo json_encode(array(
        
    'myAlertText' => 'Hello'
    )); 
    Programming today is a race between software engineers striving to build bigger and better Ń–diot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

Similar Threads

  1. Eval Security Issue in Adobe AIR 1.5.3/ExtJS 3.1.1
    By sara_762001 in forum Ext.air for Adobe AIR
    Replies: 11
    Last Post: 1 Apr 2010, 6:59 AM
  2. ExtJs Lint / correct error description / design flaw detection
    By ZeusTheTrueGod in forum Community Discussion
    Replies: 9
    Last Post: 10 Mar 2010, 8:22 PM
  3. [SOLVED] GroupView for adobe air. eval problem
    By PranKe01 in forum Ext.air for Adobe AIR
    Replies: 4
    Last Post: 4 Dec 2009, 2:33 AM
  4. is this correct way to expose eval?
    By xevin in forum Ext.air for Adobe AIR
    Replies: 0
    Last Post: 17 Jan 2009, 4:23 AM
  5. Air runtime security restriction for eval
    By MuratCorlu in forum Ext.air for Adobe AIR
    Replies: 2
    Last Post: 28 Aug 2008, 11:43 AM

Thread Participants: 1

Tags for this Thread