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 ?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
scroll top