Reputation: 1523
I have taken code from GeoTweets tutorial from Sencha Touch learning center and it's working great. I got to a point where I want a form with a Submit button which sends new request to the JSON server with changed parameters. Can anyone please guide me towards the right direction, searched for a bit on google but couldn't find anything that works with Sencha Touch.
Here is the code for the request I am making:
Ext.util.JSONP.request({
url: 'http://myserver/testdetails.php',
callbackKey: 'callback',
params: {
q: "bored",
rpp: 30,
uniqueify: Math.random()
},
callback: function(data) {
console.log(data.results);
var tweet_list = data;
timeline.update(tweet_list); // Update the tweets in timeline
}
});
};
All I want to do is reload the JSONP with new parameters.
Upvotes: 0
Views: 1684
Reputation: 2974
just have
var config = {
url: 'http://myserver/testdetails.php',
callbackKey: 'callback',
params: {
q: "bored",
rpp: 30,
uniqueify: Math.random()
},
callback: function(data) {
console.log(data.results);
var tweet_list = data;
timeline.update(tweet_list); // Update the tweets in timeline
}
}
and then change the params like this
config.params = {q:"amused", rpp:20, uniqueify: Math.random()};
Then make the request like this
Ext.util.JSONP.request(config);
Upvotes: 3