This is the simple AJAX function demo.
function AJAX(url,params,div,OW)
url - path to a local file
params - the variables to pass to the screen in URL encoded format. IE: var1=someStuff&var2=SomeOtherStuff
div - the target div for the output to be sent
OW - (over write) This is incase you want to append a div instead of over write it. Set this to true to replace the content of the target div, set it to false to add the output to the end of the target div
Download these demo files here
Copy the code here:
Just click the button below to see the text from a php file (demo.php) load into the div below
This is the most basic usage of the function. No variables, and the return output will just replace whatever is in the target div.
Update
Function called: AJAX('demo.php','','target',true)
This will change.
The div above has an ID attribute value of "target"
Just click the button below to see the text from a php file (demo.php) load into the div below
This is the same as above, but it appends the div
Update
Function called: AJAX('demo.php','','target2',false)
This will change.
The div above has an ID attribute value of "target2"
Just click the button below to see the text from a php file (demo2.php) load into the div below
This is just an output of any variables sent to the script
Update
Function called: AJAX('demo2.php','var1=Test1&var2=some other text&var3=You see where this is going','target3',true)
This will change.
The div above has an ID attribute value of "target3"