Note that there are some explanatory texts on larger screens.

plurals
  1. PO$.getJSON interpreted differently by IE - Ruby on Rails
    primarykey
    data
    text
    <p>I am trying to do the classic category -> subcategory chained dropdowns (where selecting something in category, populates the subcategory).</p> <p>The code I have works in all browsers except IE (naturally).</p> <p>Here is the JS code I am using:</p> <pre><code>$("body select#category").data_binding({ child: "select#company_subcategory_id", url: "subcategories", }); [ . . . ] data_binding: function(options) { $(this).change(function() { $.getJSON("/"+ options.url +"/", { id: $(this).val(), ajax: 'true'}, function(j) { for (var i = 0; i &lt; j.length; i++) { options += '&lt;option value="' + j[i].optionValue + '"&gt;'; options += j[i].optionDisplay; options += '&lt;/option&gt;'; } $(child).html(options); }); }); } </code></pre> <p>Subcategories controller</p> <pre><code>class SubcategoriesController &lt; ApplicationController layout 'application' def index @subcategories = Subcategory.find_all_by_category_id(params[:id]) respond_to do |format| format.js {render :json =&gt; @subcategories.collect {|sc| {:optionValue =&gt; sc.id, :optionDisplay =&gt; sc.name} }.to_json } end end def show @subcategory = Subcategory.category_permalink_like(params[:category]). permalink_like(params[:subcategory]).first @with_banner = @subcategory.companies.active.with_banner @without_banner = @subcategory.companies.active.without_banner end end </code></pre> <p>I'm tailing the development.log file and when I use any browser except IE the log shows </p> <pre><code>Processing SubcategoriesController#show (for 192.168.1.70 at 2010-08-26 01:49:06) [GET] Parameters: {"id"=&gt;"4", "_"=&gt;"1282805337516", "show_type"=&gt;"available_banners"} </code></pre> <p>but when I use IE I get</p> <pre><code>Processing SubcategoriesController#create (for 192.168.1.70 at 2010-08-26 01:50:09) [POST] Parameters: {"ajax"=&gt;"true", "authenticity_token"=&gt;"Eg2XAvSSHg/v12cKjTPt+HkKWhxdGW3s5n6lm9jHu2A=", "id"=&gt;"6"} </code></pre> <p>There is no defined create action, so it crashes.</p> <p>I have no idea why this is interpreted differently :/</p> <p>Any suggestions?</p> <p>Thanks!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload