jQuery: The Write Less, Do More JavaScript Library

Ticket #1987 (closed bug: fixed)

Opened 6 months ago

Last modified 5 months ago

.ajax with dataType: 'script' and type: 'POST' performs a GET Request

Reported by: developingchris Assigned to: anonymous
Type: bug Priority: minor
Milestone: 1.2.2 Component: ajax
Version: 1.2 Keywords:
Cc: Needs: Review

Description (last modified by davidserduke) (diff)

I did the above test case based on your title and it appears to me a 'post' is done, not a 'get'. So based on the title I'd say this works for me. I still don't understand what the patch is supposed to do even if it didn't work so feel free to reopen the bug with more details and a new test case if it seems appropriate.

Attachments

ajax_xdscript.patch (0.9 kB) - added by developingchris 6 months ago.
patch to change cross domain script block to only execute on dataType xdscript
jquery_test.html (0.9 kB) - added by davidserduke 6 months ago.
test case based on description
script.js (31 bytes) - added by davidserduke 6 months ago.
data for test case

Change History

Changed 6 months ago by developingchris

patch to change cross domain script block to only execute on dataType xdscript

Changed 6 months ago by davidserduke

  • need changed from Review to Test Case

I'm thinking about this and I'm not sure I understand what the bug is. The title says if you have 'script' and 'post' then the code is doing a 'get'. But the proposed solution is to create a new type of dataType called 'xdscript'.

So what is the actual problem? How does the solution fix it? I think I'm missing something. Please attach a test case that demonstrates it if you can.

Changed 6 months ago by davidserduke

test case based on description

Changed 6 months ago by davidserduke

data for test case

Changed 6 months ago by davidserduke

  • priority changed from critical to major
  • status changed from new to closed
  • resolution set to worksforme
  • description set to I did the above test case based on your title and it appears to me a 'post' is done, not a 'get'. So based on the title I'd say this works for me. I still don't understand what the patch is supposed to do even if it didn't work so feel free to reopen the bug with more details and a new test case if it seems appropriate.

Changed 5 months ago by developingchris

  • status changed from closed to reopened
  • resolution deleted

Please modify your test to use a fully qaulified url. Since that is the #1 trigger to get to the XD scripting block. I have a site that uses https:// and subdomains for user accounts, so almost all urls must be fully qualified in order to avoid security warnings. When a protocol is passed in the url it will always be a GET, I am sorry that this wasn't in the original ticket.

Changed 5 months ago by davidserduke

Based on my understanding of the jQuery ajax code, there are two basic ways that jQuery can request data. One is the XMLHttpRequest and the other is through a dynamically created <script> tag.

Unfortunately, the XMLHttpRequest specifically prohibits using a fully qualified domain (like http://www.example.com) by its same-origin security model.

That means all cross-domain ajax must be through the <script> tag and I'm not aware of a method to change the way a browser requests the script from a GET to a POST. I believe all your patch would do is throw an error when XMLHttpRequest gets a fully qualified domain.

I'll check to see if someone else has an idea but I suspect this will be closed again without a fix. If you have another idea feel free to post it here.

Changed 5 months ago by davidserduke

  • need changed from Test Case to Review
  • priority changed from major to minor
  • status changed from reopened to closed
  • resolution set to fixed

Fixed in [4106] such that any non-GET requests are passed on to XMLHttpRequest since a <script> type ajax request can only use GET.

Note: See TracTickets for help on using tickets.