Bug Tracker

Modify

Ticket #6616 (closed bug: worksforme)

Opened 4 years ago

Last modified 3 years ago

jQuery $.post bug with square brackets.

Reported by: dencheg Owned by:
Priority: undecided Milestone: 1.4
Component: ajax Version: 1.4
Keywords: post [] square brackets Cc:
Blocking: Blocked by:

Description

var data = {id:id, theme:cthemes, type:ctypes, region:cregions, format:cformats};

data+ id? = type; data+ id? = theme; data+ id? = region; data+ id? = format;

data+ id? = kw; data+ id? = pre; data+ id? = desc; data+ id? = adult; data+ id? = title; data+ id? = quality; data+ id? = ftstatus;

$.post( "{% url editoradmin.views.save_resource %}",

data, function(res, textStatus, XMLHttpRequest) {

alert("hello world");

});

The data I get in my python code before any changes is: {..., u'ftstatus-657031': [u'dnt'], u'theme-657031[]': [u'37'], u'quality-657031': [u'1'], u'type-657031[]': [u'9'], u'id': [u'657031'], ...}>

The problem is - [] in 'theme-657031[]'. This code works fine in 1.3.2 version, but fails in 1.4.1/1.4.2

Change History

comment:1 Changed 3 years ago by addyosmani

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to worksforme

Including square brackets when using data() works fine for me. Here are a few different examples:  http://jsfiddle.net/addyosmani/Yn5DZ/.
Also, your ticket does not appear to contain sufficient information for us to assist in reproducing the error that you submitted. It looks like you have some application/language specific code in there that isn't provided.
What I'm going to do for now as this is working for me is close it. If you still experience the issue feel free to open a new ticket.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.