{
   "isSuccessful": true,
   "resultSet": [
      {
         "name": "pradeep",
         "password": 123,
         "timestamp": "2014-04-08T12:58:45.000Z"
      },
      {
         "name": "dileep",
         "password": 1234,
         "timestamp": "2014-04-08T13:00:52.000Z"
      }
   ]
}

This invocation result i have got by using Sql adapter so how to parse this invocation result and how can i display name,password,timestamp from this JSON object.Do i need to use HTTP Adapter.

有帮助吗?

解决方案

If you want to get the length of results you should use result.invocationResult.resultSet.length which will give you the total number of results, where items is the response coming from the adapter and invocationResult contains the results and other paramaters, from which you will have to access the results for accessing only the particular output.To get value call

result.invocationResult.resultSet.name[position]

Like that call all the fields password,timestamp with position in for loop

function handleSuccess(result) {



    var invocationResult = result.invocationResult;
    var isSuccessful = invocationResult.isSuccessful;
    if (true == isSuccessful) {
        var result = invocationResult.resultSet;

        for ( var i = 0; i < result.length; i++) {
            alert(result.name[i]);
                            alert(result.password[i]);
                            alert(result.timestamp[i]);
        }

    } else {
        alert("error");
    }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top