Jquery: Passing Variable (Get)

I need to pass the variable category as GET, that is, i want in the url ?category=category but i don't know why it doesn't appear!

$(document).ready(function(e) {
    $("#sidebar li").click(function(e) {
        var category = $(this).html();
        $.ajax({
            type: 'GET',
            url: '/',
            data: {
                category: category
            },
            success: function(data) {}
        });
    });
});​

Thanks

EDIT: I need to pass the variable in the same page where I am: index.php

Answers


what should appear where ? you make the get request, but dont do anything with the return. (which is ok in some cases)

$(document).ready(function(e) {
    $("#sidebar li").click(function(e) {
        var category = $(this).html();
        $.get('/?category='+category, function(data){
             alert('Return was: '+data);
        });
    });
});​

use any debug tool like firebug or other to look at the requests you will see the request being sent by your page and why are you sending it to just / . Are you trying to post it to the same page that would make no sense. Otherwise try making one another file and accepting the get request from there.


Need Your Help

if parentViewContoller statement

objective-c iphone syntax if-statement parentviewcontroller

I'm writing a program with a UITableView with and add button in the Navigation Bar which leads to an edit page. When you click on an item in the table, a view (rView) is pushed with information