Either params function is not working or I am misunderstanding what it's
role is. In this line:
<th data-sorter="sort"><a href="<%= params[:order] %>">Site</a></th>

the value of order is either -site_num or site_num.


I have a function in javascript that alters it:
    sort: {
        insert: function(order, page){
          arr = [];
          arr[arr.length] = order;
          arr[arr.length] = page;
          return function(order_value, page_value){
            alert((typeof order_value) + " : " +
order_value.toString());
            var order_value = (order_value.indexOf("-") > -1) ?
order_value : "-" + order_value;
            var page_value = page_value;
            return {order : order_value, page : page_value };
          }
        },
        msg: "Sorting..."
      }
    }

The result gets passed through ajax:
$.ajax({
      type: 'GET',
      url: '/' + url,
      data: params,
          dataType: 'html',
      error: function(){},
      beforeSend: function(){},
      complete: function() {},
          success: function(response) {
        listview.html(response);

          var form = $('form');
          form.calculation();

          var table = $('table');
          table.calculation();

      }
    })


When I look at my query string in the console of firebug: it always
shows site_num to be negative after the first time. It's supposed to
toggle between "-site_num" and "site_num". But it never happens.

So is the params[order] not assigning a value into the href of the link?
And if it's not, then how would I do this?

I have the full javascript here:
http://stackoverflow.com/questions/3917958/query-string-always-returns-same-value-javascript

Thanks for any response.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to