homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

onclick import a file using ajax javascript php
import a file using ajax javascript php

 10:29 pm on Aug 15, 2006 (gmt 0)


Okay I'm working on an events page and there is a list of events, I want to have a button next to each event that you can click to see more details for each each event. I dont wanna have page reloads so can anyone think how to do this?

Any help much appreciated




 7:23 pm on Aug 17, 2006 (gmt 0)

Should be pretty basic. Your button's onclick just needs to send the ID of the event to a Javascript function, and you need a PHP file that can take that ID and return the info.

var http;
function getEvent(eventID) {
if (navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
if (http) {
http.open("get", "yourpage.php?event="+eventID);
http.onreadystatechange = handleResponse;
function handleResponse() {
if (http.readyState == 4) {
var response = http.responseText;
if (response && response!= "")
document.getElementById("someContainer").innerHTML = response;


Hope it helps. :)


 9:35 pm on Aug 23, 2006 (gmt 0)

Thanks for taking the time to reply garann, much appreciated

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved