Hi! How can I use AJAX in v2? Dom7.ajax/$$.ajax/Dom7.get seems doesn’t work now.
Andrey Rumyantsev
12

I am using also framework7 v.2 and i found app.request too but i wonder if you try to use template7 in your pages and retrieve the data from the request and update the template in that page… in my case it is not working but if i use the data object function it works…

do you know how to update your template using app.request call?

if i use

data: function (response) {

return {

name: ‘Jimmy’,

age: 25,

like: [‘Tennis’, ‘Chess’, ‘Football’],

}

},

works but if u I use ajax request with app.request the data is returned correctly but the template is not updated with this data object in my case I call the app.request on pageInit i return the object in success using return response; this does not work… :(

pageInit: function(e, page) {

console.log(‘pageInit’, page);

var self = this;

data = {user:’123456’};

app.request({

url: ‘_request.php’,

dataType: ‘json’,

data: data,

method: “POST”,

crossDomain: true,

statusCode: {

404: function(xhr) {

console.log(‘page not found’);

}

},

complete: function(){

console.log(‘complete’);

},

success: function(response) {

console.log(response);

return response;

setTimeout(function() {

app.preloaderHide();

}, 500);

},

error: function(){

console.log(‘error’);

}

})

Like what you read? Give raP Pan a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.