i want to fetch id from url if my url is like this: mydomain.com/Login/update/29/2
$:
function itemSubmit(){ var id1 = "<?php echo $_GET['item_id']; ?>";
alert(id1);$.ajax({ type: "POST", url: "<?php echo SITE_ROOT;?>Login/update_data"+id1, dataType: "json", }); }
Try this
var url = document.URL;
var stuff = url.split('/');
var id1 = stuff[stuff.length-2];
var id2 = stuff[stuff.length-1];