I'm new in ajax, and i want to send my data to multiple pages, i have "fetch.php" and "index.php", i tried to do something like this, and it does absolutely nothing.
function load_product(minimum_range, maximum_range, selection)
{
$.ajax({
url:{"index.php","fetch.php"},
method:"POST",
data:{minimum_range:minimum_range, maximum_range:maximum_range,"selection": sv},
success:function(data)
{
$('#load_product').html(data);
}
});
}
How can i do that ?
You can not send rame request to multiple links by passing multiple urls in url. What you can do is run a loop of urls and then doing ajax calls on all the urls
function load_product(minimum_range, maximum_range, selection)
{
var links = ["index.php","fetch.php"];
links.forEach(function(link){
$.ajax({
url:link,
method:"POST",
data:{minimum_range:minimum_range, maximum_range:maximum_range,"selection": sv},
success:function(data)
{
$('#load_product').html(data);
}
});
})
}
</div>