Bug Tracker

Opened 4 years ago

Closed 4 years ago

#15248 closed bug (migrated)

Jquery caching DELETE Request on Android

Reported by: knobli Owned by:
Priority: undecided Milestone: None
Component: ajax Version: 1.11.1
Keywords: ajax, phonegap, android, delete Cc:
Blocked by: Blocking:

Description

I'm trying to use ajax() from jquery to send a DELETE Request on Android in a Phonegap App. Like this:

function removeObject(id) {
    $.ajax({
        type : "DELETE",
        url : getAPIUrl() + '/object.php',
        data : {
            'id' : id
        },
        cache: false
    }).done(function(data) {
        if (data.success) {
            alert("Success");
        } else {
            alert("Failed");
        }
    });
}

It looks like the response will be cached, the first request is successful and will be sent to the backend, the second one with another id, is also successful but never get to the backend.

There is no such issue with the same js in Chrome and on iOS.

My workaround is to put a Math.random() variable on the ur:

	$.ajax({
		type : "DELETE",
		url : getAPIUrl() + '/object.php?' + Math.random() * Math.random(),

Change History (1)

comment:1 Changed 4 years ago by m_gol

Resolution: migrated
Status: newclosed
Note: See TracTickets for help on using tickets.