2

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 ?

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.