Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#11023 closed bug (wontfix)

Ajax calls to # fail in IE

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: ajax Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


Ajax calls made to '#' fail in Internet Explorer but they work in Firefox as expected.

Just like it's possible to post your form to '#' to post to the current page.


Even though the result in the fiddle is garbage, the error case is called in Internet Explorer and the success case is called in Firefox

Change History (7)

comment:1 Changed 11 years ago by timmywil

Component: unfiledajax
Owner: set to [email protected]
Priority: undecidedlow
Status: newpending

What is the use case for posting to '#'?

comment:2 Changed 11 years ago by [email protected]

Status: pendingnew

I usually do this if I want to send the form to the current page instead of an empty action so I know I didn't accidentally leave it empty.

But the ajax call will fail the same way if I leave the action/ajax-url empty.

comment:3 Changed 11 years ago by dmethvin

Status: newpending

It would seem that allowing this URL inside jQuery would involve mangling the incoming string somehow, which will inevitably bring other complications. I would prefer that the caller pass in a usable URL.

I've always explicitly used location.href to post back to the page, are there any drawbacks to doing that?

comment:4 Changed 11 years ago by [email protected]

Status: pendingnew

That's how I solved it right now.

I made a function that automatically enhanced normal forms with an ajax version. And this functions simply took the action and used this as the ajax url.

After I noticed that the calls would fail with "" and "#", I added a regex replace that replaces "" and "#" from the action to document.location.href

But I thought it might be something that jQuery could do to make the experience the same in a cross browser fashion.

comment:5 Changed 11 years ago by addyosmani

I agree with Dave on this one - I think we should we should expect a sensible URL to be passed. I don't think there's a case for us changing the incoming string just to enable the support for '#'. I'll ask in -dev later just to check if there are arguments for keeping this open :)

comment:6 Changed 11 years ago by dmethvin

Resolution: wontfix
Status: newclosed

Use location.href when needed.

comment:7 Changed 10 years ago by dmethvin

#14175 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.