Skip to main content

Bug Tracker

Side navigation

#11023 closed bug (wontfix)

Opened December 14, 2011 01:05PM UTC

Closed January 11, 2012 04:07PM UTC

Last modified July 27, 2013 02:39AM UTC

Ajax calls to # fail in IE

Reported by: ezra@tsdme.nl Owned by: ezra@tsdme.nl
Priority: low Milestone: None
Component: ajax Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

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.

Fiddle

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

Attachments (0)
Change History (7)

Changed December 14, 2011 02:57PM UTC by timmywil comment:1

component: unfiledajax
owner: → ezra@tsdme.nl
priority: undecidedlow
status: newpending

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

Changed December 15, 2011 09:50AM UTC by ezra@tsdme.nl comment:2

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.

Changed December 15, 2011 01:44PM UTC by dmethvin comment:3

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?

Changed December 15, 2011 04:46PM UTC by ezra@tsdme.nl comment:4

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.

Changed December 26, 2011 06:19PM UTC by addyosmani comment:5

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 :)

Changed January 11, 2012 04:07PM UTC by dmethvin comment:6

resolution: → wontfix
status: newclosed

Use location.href when needed.

Changed July 27, 2013 02:39AM UTC by dmethvin comment:7

#14175 is a duplicate of this ticket.