Frage

I implemented a custom Rest Api in my module. Until now everythhing works fine. Jquery Ajax is used to call the api. The JS Code is below:

                $("#p").click(function(){
                      $.ajax({
                         url: "http://127.0.0.1/rest/V1/ajax/l/-100/b/0-300/fo/a/fa/a/p/100-/cat/a",
                         type: "GET",
                         beforeSend: function(xhr){
                               xhr.setRequestHeader('content-type', 'application/json');
                               xhr.setRequestHeader('cache-control', 'no-cache');
                                                                                                   },
                         success: function(response) { $('#b').html(response);}
                      });
                }); //close onclick       

When inspecting the Ajax call in Browser, the following is shown: enter image description here

Everything works fine and I receive the correct response. But I am asking myself why this number (see red arrow) is automatically appended in the request?

How can I prevent that behavior ?

War es hilfreich?

Lösung

This parameter is added by jQuery to circumvent an Internet Explorer behavior. It is only applied to GET requests and only if cache is false.

Specify cache: true in your ajax request to get rid of it.

See jQuery Docs

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top