communication between Rails and Ajax

Hey all,

I'm enduring an intense struggle. It involves when a user selects an
option from dropdown menu, it filters the fields. However, when I try
it, nothing happens. I would like to achieve this without any rails or
jquery plugins. The only plugin I would use is will_paginate and the
only javascript library I will use is jquery without any plugin.

When the user selects an option from dropdown, we call listLoader again
passing the data literal a value of data, which is the actual value of
the option element they selected (e.g. United States). This information
is therefore in the query string (or it should be) in the url. So we can
then use the params feature of Rails to capture it in controller.
    var listview = $('#listview');

    $('#dashboard a').click(function(){listLoader(this);})

    var listLoader = function(context, options){

        for(var i = 0; i < arguments.length; i++){
            var data = arguments[1]

        var url = context.href.substring(context.href.lastIndexOf('#') +

            type: 'GET',
            url: '/' + url,
            data: data, //this is converted to a query string
              dataType: 'html',
            error: function(){},
            beforeSend: function(){},
            complete: function() {},
              success: function(response) {

                    var option = $(this).val();
                    listLoader(context, option);
                //end for change

//Here we check if there is a params, and if so, we capture the value of
the data parameter, call an instance method, which runs a sql statement
and then pass the value to @sites.
def index
    if params[:filter]
      @sites = Site.filterize(params[:data])
      @sites = Site.find(:all)

    respond_to do |format|
      format.html {render :partial => "sites/index" }

//Below is the instance method
class Site < ActiveRecord::Base
  belongs_to :country

  def self.filterize(criteria)
    Site.find_by_sql("SELECT * FROM sites WHERE

//Then we iterate through the instance method in our view:
    <label>Filter by:</label>
    <select name="filter">
        <option selected="selected">Default:</option>
        <% Country.enabled_countries?("1").each do |c| %>
        <option><%= %></option>
        <% end %>

    <label>Search by:</label>
    <input type="text" />

    <input type="button" />

        <% @sites.each do |i|%>
        <tr class="<%= cycle("even", "odd") %>">
            <td><%= i.site_num %></td>
        <% end %>
<div id="paginater">

Can anyone provide some insight as to what I'm missing here?

Thanks for any response.