Hi,
I’ve an application where all the initial contents have been displayed on a view.
Now on clicking some buttons i want to call some Ajax function which i stored them on models and then i want to update the current view with the returned content!!
Here I don’t want to update the whole view but just a portion of the current view with the information returned…
And I’ve another doubt, how can i pass the values of a certain model or a session value to the Ajax calls , just now i used to define the js functions in the main.php of layouts folder.
for example
var role = 1; // consider if i need this value to be fetched from any session or model, what can i do?
function regInvite(role){
if(role==1 || role==3){
//some code
}
else if(role==2){
//some code
}
var receiverUserIds = FB.ui({
method : 'apprequests',
},
function(receiverUserIds) {
if(receiverUserIds){
$.ajax({
type: "POST",
url: "file.php",
message: msg // this message will be decided on the first if block where role is checked
data: "r=controller/action&req_ids="+receiverUserIds.request_ids,
success: function(msg){ // consider if msg is html content which need to updated back to view, what can i do?
if(msg =="1"){
window.location.reload();
}
}
});
}
});
}