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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.