I'll try explain this the best as I can. What I want is a link that will change the data displayed in another part of the webpage (and this data is extracted from a MYSQL database using PHP) by sending a variable (a number between 1 and 10) - but I don't want the page to reload (so I want to do this locally). Is it even possible? I'd assume it is - either using JS or AJAX. If it is then can someone please put me out of my missery and tell me how to do it? Thanks, TS
Hi , This can be easily done using AJAX. All you have to do is assign an ID to the element which contains this data and then you can of course change its inner content dynamically by passing the values to a javascript function. AJAX becomes very easy if you use a library like prototype. If you use prototype.js then the following function will make your life easier function changeData(id){ var id=id; $('youdivname').innerHTML=''; $('youdivname').innerHTML="<div style='text-align:center'><img src='images/wheel.gif'><h1>Loading Data...</h1></div>"; var url = 'ajax.php'; //this is the page which returns data it should accept the id in get array and change mysqlquery mapped to the id var params = 'id='+id; var ajax = new Ajax.Updater( {success: 'yourdivname'}, url, {method: 'get', parameters: params, onFailure: 'youhaveanerro'} ); } Code (markup): that's all revert back if you have any doubts...