I'm new to ajax so bear with me. Here's what I need to do.
I have an area of a page that has a search look-up for cover art. Currently, when you click on it, it fixes the url and fills a field in that section of the page. I can then copy and paste the url and paste it in a form field in the lower section of the page, a form.
This is of course a waste of energy. How do I fix it so that when I click on the image it automatically fills the designated form field?
I have my ajax request code below.
var req;
function loadXMLDoc(url, params)
{
if(window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch(e) {
req = false;
}
} else if(window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
if(req) {
req.onreadystatechange = processReqChange;
req.open("GET", url + '?' + params, true);
req.send(null);
return true;
}
return false;
}
I figure that I want to capture my url for the form which is http://www.example.com/?q=node/add/cover_art
The field name is "field_cover_link".
I have been through a lot of ajax examples, but haven't gotten my head around them well enough to see what to take from them to make this happen.
I'm not looking someone to write the script for me, because I need to learn how this stuff all works.
Thanks
spivey