I tried many way but I can't get access I keep getting undefined or can't access property of x in javascript.
Heres my object http://pastebin.com/5kDBicRz
I tried a combination of JSON.prase and
var posting = $.getJSON( url, { s: term } );
data.statuses[1].id etc
but I'm having no luck. Can someone tell me how I can access id in statuses?
$("#searchForm").submit(function(event) {
event.preventDefault();
var data;
var $form = $(this),
term = document.getElementById('search').value;
url = $form.attr( "action" );
var posting = $.getJSON( url, { s: term } );
posting.done(function(data) {
console.log(data.statuses[1].id_str);
});
});
Do you realize you are misspeling statuses? data.statuses[1].id works fine
hmn, why are you not using the variable u assigned it to ?
var posting = $.getJSON( url, { s: term } );
posting.statuses[1].id etc
why not use jquery ajax function with success handler ? and at least log the response ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.