tags:

views:

21

answers:

1

Hi, I want to take URL parameter and pass to ajax function,

    var queryParams = dojo.queryToObject(window.location.search.slice(1));
    var data = dojo.toJson(queryParams, true);
     console.log(data);
    getCategory( data );
...
function getCategory(input){


    dojo.xhrGet( {
            // The following URL must match that used to test the server.
            url: "http://js.localhost/dojo-release-1.5.0-src/json3.php",
            handleAs: "json",
            content: input,

on my URL parametetr, I pass in

?return_type=category&category_desc=Business2

when I view on firebug, the ajax request become ....

t?0=%7B&1=%0A&2=%09&3......

but data debug is correct, any idea what's wrong?

{ "return_type": "category", "category_desc": "Business2" }

A: 

just found out that it doesn't need dojo.toJson

var queryParams = dojo.queryToObject(window.location.search.slice(1));
getCategory(  queryParams );
cc96ai