Question

{
   "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.

Était-ce utile?

La solution

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");
    }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top