Try this :
function getUrlParams(url) {
var params = {};
url.substring(1).replace(/[?&]+([^=&]+)=([^&]*)/gi,
function (str, key, value) {
params[key] = value;
});
return params;
}
Usage:
function pop(e) {
var url = $(e.target).attr("href");
var params = getUrlParams(url);
var cat= params["cat"];
var type= params["typ"];
alert(cat);
alert(type);
}
Working Fiddle
You can do as soeme thing as below
$('a').bind('click',function(){
var url = ($(this).attr('href'));
var cat = getURLParameter(url, 'cat');
var typ = getURLParameter(url, 'typ');
//calling the ajax function
pop(cat, typ)
});
function getURLParameter(url, name) {
return (RegExp(name + '=' + '(.+?)(&|$)').exec(url)||[,null])[1];
}
function pop(cat, typ) {
$.ajax({
type:'post',
url:site_url()+'/event/deleteEventSingle',
data:{'cat':cat,'type':typ},
async:false,
success:function(result){}
});
}
Check out the the example at Live fiddle http://jsfiddle.net/mayooresan/aY9vy/