"get parameter values from href in jquery" Code Answer

4

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/

By Shattuck on July 20 2022

Answers related to “get parameter values from href in jquery”

Only authorized users can answer the Search term. Please sign in first, or register a free account.