/** * Name: * banners.js * * Description: * It processes the banner request and calls the php file for database insert. * * Preconditions/Input: * * Postconditions/Output: * * Libraries: * * Stored Procedures: * None * * Log: * Nishchay Shah 07/21/2008 * - Creation * * */ function insertClicks(bannerXId, bannerXGroupId) { var queryStr = "bannerXId="+bannerXId+"&bannerXGroupId="+bannerXGroupId; var url = "http://classifieds.mykdkd.com/banner/banner_insert.php"; AjaxRequest(url,queryStr); } function AjaxRequest(url,queryStr) { // Mozilla, Safari, Opera... if (window.XMLHttpRequest) { clickResponse = new XMLHttpRequest(); //alert("clickResponse"+clickResponse); // Request type is xml if (clickResponse.overrideMimeType) { clickResponse.overrideMimeType('text/xml'); }// end if, request overrideMimeType checking // IE } else if (window.ActiveXObject) { // Above IE5.x try { clickResponse = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { // Under IE5.x try { clickResponse = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} }// end if, IE }// end if, browser checking // If clickResponse is null then alert if (!clickResponse) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; }// end if, clickResponse checking url = url+"?"+queryStr; // Set a callback to be invoked when the ReadyState changes on the XMLHTTP object. clickResponse.onreadystatechange = AjaxResponse; // Specify HTTP Method as POST so that we can upload large amounts of text clickResponse.open("GET",url,false); // Insert the "Drag And Drop" station box information in database // and Send the HTTP Request clickResponse.send(null); }// END FUNCTION - AjaxRequest function AjaxResponse() { // only if clickResponse shows "complete" if (clickResponse.readyState == 4) { // only if "OK" if (clickResponse.status == 200) { result=clickResponse.responseText; alert(result); if(result != "true") { // alert("There was a problem retrieving the XML data:\n" + clickResponse.responseText); alert('test FALSE'); return false; }// end if, status checking else{ alert('test TRUE'); return true; } }// end if, readstate checking } // }// end function - AjaxResponse