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();
});
});
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");

alert()prints strings so it needs to convert the object to string. You should debug with Firebug's console or your browser's equivalent tool.