Hi all,

Actually i want to two link in my page using ajax. Let me explain the problem:

Like my site have three page in which about me, contact me and personal info are three page . All these three page are connected with database and fetching some information from database.
But when i click any of these links page is going to refresh.

But i want page should not refresh. I think using ajax i can do this. But correct way i do not know. So please help me to solve this problem. My means when i will click on contact me or about me page then page should not be refreshing. Directly it should be connected with database.

I know for this i will have to use onclick event . But onclick event what type of ajax function i should use that i don't know.

Please help me . I will be thankful of that person who will help me .

7 Years
Discussion Span
Last Post by yilmazhuseyin

HI all,
I am working on one application using ajax.When i m clicking on a link . I want that page should not be refresh . How i can do this in ajax. I know onclick event i will have to use for this. But how in correct way i should use this. I do not know . So please help me to solve this problem.

Like i have two pages contact page and index page. when i am in index page when i click on contact page ,then page will not be refresh and when i will be in contact page and when i will click on index page link then again page will not be refresh . Both of page will fetch some data from database.

Please help me to do this work. I am doing such type of work first time. Please help me to provide ajax code for this. If it is not possible then please suggest me.


You already wrote the answer on the title. You can use ajax. I suggest you to go to an ajax tutorial page and learn how it works. Because what you want to do will be an example on that page. Anyway let me explain what you will do. when your links clicked instead of linking your page you will call a javascript function. function will goto server and bring content of the page in string format. and you will put your content in your page like following

document.getElementById('mainDivElement').innerHTML = responseText;

if it seems comlicated. make 3 ajax example. read this again. you will understand everything perfectly.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.