I'm having a bit starting problem with java ajax.
I have this rather simple script
Expand|Select|Wrap|Line Numbers
- function UpdateSQL(ReleaseID, MediaTypeID, sideElement) {
- if (typeof XMLHttpRequest != 'undefined') {
- return new XMLHttpRequest();
- }
- try {
- return new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- return new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {}
- }
- return false;
- req.onreadystatechange = function() {answerUpdateSQL(sideElement);};
- req.open("GET", "Submit2-addmedia.php" + "?ReleaseID=" + ReleaseID + "&MediaTypeID=" + MediaTypeID", true);
- req.send(null);
- }
- function answerUpdateSQL(sideElement) {
- var output = '';
- if(req.readyState == 4) {
- if(req.status == 200) {
- output = req.responseText;
- document.getElementById(sideElement).innerHTML = output;
- }
- }
- }
[HTML]<img src="Graphics/Tree/cd.gif" onClick="UpdateSQL('1','4,'show');">
<div id="show"></div>[/HTML]
This should get the Submit2-addmedia.php file with the extensions ReleaseID = 1 and MediaTypeID = 4 but it just doesn't work.
Nothing happens when I click the image.
I have tried removing the extensions so the script is just
req.open("GET", "Submit2-addmedia.php", true);
and in the file just write "Test"
But Test is not written in the show div.
So something is wrong so it doesn't get the fle probably.
But I'm new at this, and I just can't figure it out ?
So can anyone tell me what I'm doing wrong.
It's probably a simple little thing I'm missing ??
Best
Michael