format url by js

HI all,

         One of my application i need to change url from jquery. like

       www.abc.com/category/categoryname

below i giving my code

$.ajax({

url: "/Category/GetCategoryDetails/",
type: ‘GET’,
dataType: ‘json’,
data: { selectcat: selectedCategory },

contentType: ‘application/json; charset=utf-8′,
success: function (data) {

}

});

if i select category from dropdown that category name should come in url. now not coming.How i achive this.

Hi,

what’s selectedCategory?

Instead of hardcoding the url you can make it a variable and fill it up by string concatenation to form the specific url you want to call. For example:

var url = ‘/Category/’ + selectedCategory;

Grz, Kris.

Hi,

        Selectedcategory is category which i selected from source.  Basis of selected category i retrieving value from db . In url section in my first post i giving controller name and function name

Leave a Reply