I send an Ajax GET request with this code:

//...Тут объявлены переменные $.ajax({ type: "GET", url: "//url.com/m.php", data: "bm="+bm1+"&me="+me1, }); 

You need to go to this page (url.com/m.php) with the given parameters in data. I guess I need to write success: function () {}, but what exactly is there to write?

  • The query string can be generated using $ .param (data); - etki
  • success: function () {window.location.href = ' your.site/page.php?bm= ' + bm1 + '& me =' + me1; } If I understand correctly - dekameron

1 answer 1

if you need to send ajax, in case of a successful answer, go to another page, then in success you should write document.location.href = 'http://your.site/page.html' ;. Url on which to go can be returned in the answer ajax.

  • The fact of the matter is that the url should be with parameters, and not clean - Rammsteinik
  • one
    well, what's the problem? Create a url in php, send it in the ajax response. For example in json, if you need several parameters in the answer. Or there is a base url: var url = ' your.site/page.php '; in success, add parameters to it: url = url + '? param1 =' + res.param1 + '& param2 =' + res.param2; document.location.href = url; Something like that - Barton
  • What you need, just res. cleaned and earned - Rammsteinik