Jump to content

Running a database insert on image click


ukscotth

Recommended Posts

You will need a "onreadystatechange"

xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4){
	// Do something here //
}
}

The returned data will be contained in xmlhttp.responseText;

Add this just before your xmlhttp.open() call.

You could also split your responseText using a \n I guess.

For example, your AJAX would return something like

<img src="1.jpg">
<img src="2.jpg">

and then using javascript to split it..

var parts = xmlhttp.responseText.split("\n");

part[0] would contain <img src="1.jpg"> and part[1] would contain <img src="2.jpg">

 

Or..something (its 1:30 and I have to bee up in 6hrs for work so im a little scattered)

The only other way would be to return a javascript object which you would more than likely have to eval() to make it usable.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.