Q:

Parsing URL string in into JSON keeps retuning blank object

I can't fingure out why this code doesn't work: 
$(document).ready(function() { 

    $(".alertDeleteButton").click(function(e) {

        var str = $(this).attr("href");
        alert(str);

        var obj = str.split("&").reduce(function(prev, curr, i, arr) {
            var p = curr.split("=");
            prev[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
            return prev;
        }, {});

        alert(obj);

        e.preventDefault(); 
    });

}); 

jsFiddle
All I want to do, is use the string in in a link when pressed by a user and create a json object.
{"userdeleteid": "55", "dayid": "55"}. etc... 
I've searched and found about 3 different ways to do it, and they ALL give me the [object Object] result. 
I wanted to implement this, but it seems to only look at the URL in the browser, I want it to look at the value of the link via (this).attr("href");

A:

You should use JSON.stringify(), like this: 
alert(JSON.stringify(obj));

