Bug Tracker

Ticket #11490 (closed bug: duplicate)

Opened 2 years ago

Last modified 2 years ago

$.post() requires a value back

Reported by: eldmannen+jquery@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

$.post("/Foo", { id: "2" });

This will make Firefox state "no element found".

If on the server side there is:

[HttpPost]
public void Foo(int id)
{
    // Nothing
}

However, if I switch the 'void' to 'bool' and return true, then it works:

[HttpPost]
public bool Foo(int id)
{
    return true;
}

Now Firefox does not say "no element found" anymore.

It seems that jQuery requires/expects a value to be returned by the server for the POST request. However, the server already returns HTTP 200 OK which should be enough.

Change History

comment:1 Changed 2 years ago by rwaldron

  • Status changed from new to closed
  • Resolution set to duplicate

comment:2 Changed 2 years ago by rwaldron

Duplicate of #11489.

comment:3 Changed 2 years ago by anonymous

It is not possible to reproduce this with the echo service provided by jsfiddle because of limitations in jsfiddle. Namely it always returns a Content-Type header.

The bug occurs when the response does not contain a Content-Type header.

Note: See TracTickets for help on using tickets.