English 中文(简体)
通过Json号版向Java
原标题:Getting PHP array to JavaScript through Json

Hey, I ve got a PHP file that呼应一个阵列,被编为json_encode。 该档案被j Query ajax功能用来检索阵列。 我无法说明如何使用这些阵列,尽管我已设法提醒变量,但并非阵列。 我的守则是:

function sessionStatus(){
    $(document).ready(function(){
        $.ajax({type:"POST", url:scriptRoot+"sessionStatus.php", success:function(data){
                alert(data[0]);
            }
        });
    });
}
最佳回答
json_encode(array("data1","data2"));


$.getJSON("sessionStatus.php",function(data){
      alert(data[0]);
});

备战“数据1”

问题回答

您需要使用

数据:作为不喜欢阵列的物体的产权





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签