1

I'm trying to call a web service to get some data. I need pass this URL in a GET method:

http://localhost/ecosat/ws/api.php?t=vw_motorista

But, when I look in Chrome Developer Tools, the link is:

http://localhost/ecosat/ws/api.php?t=vw_motorista&_=1397500899753

I'm not passing this parameter: &_=1397500899753

With this additional parameter, I received a 500 error. I can't change the web service to handle this.

What's going on? Is Chrome is changing my code?

This my Ajax

function get(pURL, pToken) {
    var ret = null;

    $.ajax({
        type: "GET",
        dataType: "json",
        async: false,
        timeout: globalTimeOut,
        cache: false,
        url: pURL,
        headers: {"Token": pToken},
        error: function(request, status, error) {
            ret = null;
        },
        success: function(data) {
            ret = data;
        }
    });
    return ret;
}
Vitor Villar
  • 1,687
  • 12
  • 30

1 Answers1

1

You're probably using cache: false setting in your ajax query. It adds a _ parameter with a timestamp value, to make sure that your ajax call doesn't get cached by the browser.

Remove this setting, if you don't need it. But if you need make sure caching is disabled, you could try two things:

add your own parameter with a timestamp to your query, e.g. {ts: new Date.getTime()}, or

if possible, add headers to the web server response. See this question

Community
  • 1
  • 1
keune
  • 5,621
  • 4
  • 30
  • 48