function update(id, flag) {
var flag_count = jQuery(flag + id).html();
flag_count++;
jQuery(flag + id).html(flag_count);
jQuery.ajax({
url: 'update_count.php',
type: 'post',
data: {
type: flag,
id: id
},
success: function(result) {
}
})
}
How to pass parameters in data but flag and id are arguments of the function.
How to write this?
data:'type='+flag+'&id='+id
Pls help...
Below there is a JavaScript approach. You normally add this function inside your function, the same way as you do with jQuery.
The above code will pass the values stored inside each variable (flag, id) to the ajax file (update_count.php).