javascript - Access JSON data inside brackets - home({"a": { "prop1": "data", "prop2": "data"}); -


i'm getting result when calling service below.

call:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>  <script>     function getdata() {              var clientid = '123';         var pagename = 'home';         var serviceurl = 'https://service.com/meta?_callback=home&_o=' + clientid + '&_t=' + pagename + '';               $.ajax({             url: serviceurl,             method: 'get',             aynch:true,             success: function (data) {                    console.log(data);             },             error: function (data, textstatus, errorthrown) {                 alert('service call error '+ errorthrown);             }         });     } </script> 

response:

home({       "a": {        "prop1": "data",         "prop2": "data"       },       "b": {         "prop1": "data",         "prop2": "data"       } }); 

how access data of result using javascript ?  

this looks lot jsonp response!

have read on jsonp (http://en.wikipedia.org/wiki/jsonp)

<!-- call api --> <script src="http://api.url.com?callback=home"></script> <script>      // handle response      function home(data) {          console.log(data);      }  </script> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -