You just need the jQuery library for your Ajax to work. Other libraries, if you include them, might hang the page because they may not be async or they might require other parameters to be async in nature.
Quote:
my pages hangs when it reaches to execute the code of ajax({}).
The "
A" in Ajax stands for asynchronous. Which means, that the code must execute asynchronously and should avoid holding on to the main thread which makes the page responsive. I have a few of my own pages, running on my website and they are responsive.
$(document).ready(function () {
$("#btn").click(function() {
$.ajax({
url: 'your/path',
data: { query: string },
success: function (data) {
}
});
});
});
Try this code in your pages for once.
This must never hang your page. The pure jQuery solution for Ajax is asynchronous and does nothing to hang, if your page does get hung, you need to check what other libraries are you trying to load and whether there are some logging or analytics suite that are trying to hang your page.
jQuery.ajax() | jQuery API Documentation[
^]