I want to make an ajax request and it wont work. This is my code:
function loadSingleProductPaso1(div_loading,div_id,index, json,ajaxurl){
$.ajax({
type: "POST",
url: ajaxurl, //the url is http://www.mysite.com/controller/function
data: "ajax=true&precio="+JSON.parse(json[index]).miprecio,
success: function(msg){
...
}
}
});
}
The thing is, when I add a '?' to the data element (data: "?ajax=true&..."), it works, but sends a $_POST['?ajax'] variable.
I really don't understand what am I doing wrong.