Wikipedia:Reference desk/Archives/Computing/2023 April 17

Computing desk
< April 16 << Mar | April | May >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


April 17

edit

HTML POST Request

edit

I am trying to send a HTML post request with this code:

 function offer(userid, address, startTime, endTime) {
    function onSuccess()
    {
        console.log("offer was successfuly added");
    }
    var offerUrl = BASE_URL + "orders" + "?userid=" + userid;
        console.log("Sending POST to " + offerUrl);
        console.log(userid + address + startTime + endTime);
        $.ajax(offerUrl, {
            type: "POST",
            data: {address: address, startTime: startTime, endTime: endTime},
            success: onSuccess,})
}

The code looks like it should work, but I cant get the destination page to say anything other than {"status":"fail","data":[{"reason":"404 - No matching records"}]}.

The Url I'm trying to use is: http://137.108.68.13/openstack/taxi/orders?userid=2

So, could you please offer me some assistance in this matter? Thank you. 2A00:23C5:B23A:ED01:F134:1DF9:2DF5:59AE (talk) 16:37, 17 April 2023 (UTC)[reply]

I'm not a developer so maybe this is bad advice but whenever I've done anything like this, I've always found it best to use and intercepting proxy like Burp or others I can't remember the name of. Then you can see what is actually being sent to the server rather than just guessing from your code and the server's responses. While to be fair this can also have unexpected complications especially with Cloudflare and maybe some other advanced bot detection systems at least you can get some idea is what's going on. Nil Einne (talk) 02:39, 18 April 2023 (UTC)[reply]

Does BASE_URL end in a slash? --jpgordon𝄢𝄆𝄐𝄇 23:48, 19 April 2023 (UTC)[reply]