Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery sending post data without defining url

Tags:

jquery

Is it possible to send data via ajax or post and not to define url? This is the code I am trying to work:

$("#gll_delete").click(function(){
    var gll = $("#gll").val();

    var gll_string = gll.split(' ');
    var gll_id = gll_string[0];
    console.log(gll_id);
    var data = "gll_id=" + gll_id; 
    $.ajax({
        type : "POST",        
        data : data
    });
}); 
like image 307
Sasha Avatar asked Dec 04 '25 11:12

Sasha


1 Answers

You need to specify a destination for this request. If it should be the same page (like an empty action attribute on a html form reacts) you could do:

url: location.href
like image 123
binarious Avatar answered Dec 07 '25 00:12

binarious