There is a menu
<ul class="nav nav-tabs nav-stacked main-menu mainmenu_user"> <li class="active"><a href="/settings/" data-history="/settings/" data-href="/ajax/settings.php"><span class="hidden-tablet"> Настройки</span></a></li> <li class="active"><a href="/settings/" data-history="/settings2/" data-href="/ajax/settings2.php"><span class="hidden-tablet"> Настройки2</span></a></li> <li class="active"><a href="/settings/" data-history="/settings3/" data-href="/ajax/settings3.php"><span class="hidden-tablet"> Настройки3</span></a></li> </ul>
I am trying to write a script that would take the value from data-href and get json from there, I would also like to insert the data-history parameter into the address bar, but I have not yet understood how to do it
$(document).ready(function(){ $('.mainmenu_user li a').click(function(){ var url_ajax = $(".mainmenu_user li a").data("href"); $.getJSON(url_ajax, {}, function(json){ $('.content').html(''); }); }) });