1

I am learning j query and i want to send id in current URL then UL Li on click event to send id in current URL without page refresh

like this:

Current URL = localhost/backupapp-latest-21-05/index.php?r=site/Application<br>
send id url = localhost/backupapp-latest-21-05/index.php?r=site/Application&abcid=48

there is a abcid=48 is my UL Li id

try this code :

$(document).ready(function(e) {
   $('#hari-ul > li').each(function(index, element) {

      $(element).click(function(e) {
         var id = (this.id);
         window.location.href  = "index.php?r=site/Application&abcid="+id;

      }
    });
  });
});

this code send id in URL but page refresh and i want id without page refresh

Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177
hari maliya
  • 660
  • 8
  • 21

1 Answers1

1

Try this way:

$.ajax({
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

Check the examples here:

Check here

Or try this way :

$.get('path/to/yourfile.html', function(data) {
  //do something
});
Vimalnath
  • 6,373
  • 2
  • 26
  • 47