//Begin AJAX //Browser Support Code function goToPage(loc) { var ajaxRequest; try { // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); alert("ajaxRequest created!"); } catch (e) { // Internet Explorer Browsers try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(loc) { if(ajaxRequest.readyState == 4) { if(ajaxRequest.status == 200 || ajaxRequest.status == 304) { document.getElementById('greenBox').innerHTML = ajaxRequest.responseText; } } } //contruct url var url = "pageserver.php?loc=" + loc ajaxRequest.open("GET", url, true); ajaxRequest.send(null); }
<?php //Begin frame /* if ($_GET['loc'] == "") { $textRight = ""; $textLeft = ""; echo encap($textRight, $textLeft); } */ require_once("inc/dbinfo.inc"); if ($_GET['loc'] == "home") { $textRight = '##############################################'; $textLeft = '###############################################'; echo encap($textLeft, $textRight); } if ($_GET['loc'] == "register") { $textRight = '##############'; $textLeft = '################'; echo encap($textLeft, $textRight); } if ($_GET['loc'] == "browse") { $query = "######################"; $result = mysql_query($query); for($i=0; $i > 10; $i++) { $array = mysql_fetch_assoc($result); if ($i == 0) { $textRight = #########################; $textLeft = ######################; } else if ($i > 0) { $textRight = #############################################; $textLeft = ##############################################; } echo encap($textLeft, $textRight); } } if ($_GET['loc'] == "about") { $textRight = '############################'; $textLeft = '#############################'; echo encap($textLeft, $textRight); } if ($_GET['loc'] == "bid") { if (!$_GET['id']) { //error } else if ($_GET['id']) { $id = $_GET['id']; $query = "#########################"; $result = mysql_query($query); $array = mysql_fetch_assoc($result); } echo encap($textLeft, $textRight); } function encap($textLeft, $textRight) { return ('<span id="leftBox" class="leftBox">'.$textLeft.'</span><span id="rightBox" class="rightBox">'.$textRight.'</span>'); } ?>
<script type="text/javascript"> // <![CDATA[ var ie = (( !!document.all && !!!document.getElementById ) ? 1 : 0 ); // Checks whether it is an IE based browser or not. // Request Handler var handleMyRequest = function() { var seq = { 4 : "complete", complete : 4 }; if ( seq[ this.readyState ] ) { // Request state my hold (STRING/INTEGER) value. if ( this.status === 200 || this.status === 304 ) { /* The request status handling can be turned off when you are working off-line. */ (( ie ) ? document.all.greenBox : document.getElementById( "greenBox" )).innerHTML = this.responseText; } } }; // Request Builder var XHR = function( method, url, callback ) { this.createRequest = null; this.xml = 0; this.method = method || "GET"; this.url = url || null; this.callback = callback || null; if ( arguments.length < 3 ) { return false; } this.xmlDoc = ( function() { try { if ( !ie ) { this.xml = new XMLHttpRequest(); } else { try { var client = [ "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ]; for ( var i = 0; i < client.length; ++i ) { if ( new ActiveXObject( client[ i ] )) { this.xml = new ActiveXObject( client[ i ] ); break; } } } catch( e ) { this.xml = 0; } } } catch( er ) { if ( "createRequest" in window ) this.xml = createRequest(); else this.xml = 0; } return (( this.xml ) ? this.xml : 0 ); } )(); if ( this.xmlDoc ) { this.createRequest = ( function( xhr, callback, url, method ) { (( "overrideMimeType" in xhr ) ? xhr.overrideMimeType("text/xml") : xhr ); xhr.onreadystatechange = callback; xhr.open( method, encodeURI( url ), true ); (( method === "POST" && "setRequestHeader" in xhr ) ? xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;") : xhr ); xhr.send((( method === "POST" ) ? " " : null )); } )( this.xmlDoc, this.callback, this.url, this.method ); } return this.createRequest; }; onload = function() { var loc = ""; // Your given value or reference; var url = "pageserver.php?loc=" + loc; new XHR( "GET", url, handleMyRequest ); // Building AJAX Call, via onload event. // The call can be manipulated on any event. // You can create new instance of request by calling out, the same procedure above. }; // ]]> </script>
this.method = method || "GET";
// <![CDATA[ var loc = 'home'; var ie = (( !!document.all && !!!document.getElementById ) ? 1 : 0 ); // Checks whether it is an IE based browser or not. // Request Handler var handleMyRequest = function() { var seq = { 4 : "complete", complete : 4 }; if ( seq[ this.readyState ] ) { // Request state my hold (STRING/INTEGER) value. if ( this.status === 200 || this.status === 304 ) { /* The request status handling can be turned off when you are working off-line. */ (( ie ) ? document.all.greenBox : document.getElementById( "greenBox" )).innerHTML = this.responseText; } } }; // Request Builder var XHR = function( loc ) { this.createRequest = null; this.xml = 0; this.method = method || "GET"; this.url = url || null; this.callback = callback || null; if ( arguments.length < 3 ) { return false; } this.xmlDoc = ( function() { try { if ( !ie ) { this.xml = new XMLHttpRequest(); } else { try { var client = [ "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ]; for ( var i = 0; i < client.length; ++i ) { if ( new ActiveXObject( client[ i ] )) { this.xml = new ActiveXObject( client[ i ] ); break; } } } catch( e ) { this.xml = 0; } } } catch( er ) { if ( "createRequest" in window ) this.xml = createRequest(); else this.xml = 0; } return (( this.xml ) ? this.xml : 0 ); } )(); if ( this.xmlDoc ) { this.createRequest = ( function( xhr, callback, url, method ) { (( "overrideMimeType" in xhr ) ? xhr.overrideMimeType("text/xml") : xhr ); xhr.onreadystatechange = callback; xhr.open( method, encodeURI( url ), true ); (( method === "POST" && "setRequestHeader" in xhr ) ? xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;") : xhr ); xhr.send((( method === "POST" ) ? " " : null )); } )( this.xmlDoc, this.callback, this.url, this.method ); } return this.createRequest; }; onload = function() { var loc = ""; // Your given value or reference; var url = "pageserver.php?loc=" + loc; new XHR( "GET", url, handleMyRequest ); // Building AJAX Call, via onload event. // The call can be manipulated on any event. // You can create new instance of request by calling out, the same procedure above. }; // ]]>
var XHR = function( method, url, callback );
var check = ( Boolean((( XMLHttpRequest ) ? 1 : 0 ))); var handleMyRequest = function() { var seq = { 4 : "complete", complete : 4 }; if ( seq[ this.readyState ] ) { alert( this.responseText ); if ( this.status === 200 ) { (( check ) ? document.getElementById("greenBox") : document.all.greenBox ).innerHTML = this.responseText; } return; } alert("Request failed!\nPlease verify your QueryString..."); }; var XHR = function( loc ) { this.createRequest = null; this.loc = loc || null; this.url = "pageserver.php?loc=" + this.loc; this.xml = 0; var method = "GET"; this.xmlDoc = ( function() { try { if ( check ) { this.xml = new XMLHttpRequest(); } else { try { var client = [ "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ]; for ( var i = 0; i < client.length; ++i ) { if ( new ActiveXObject( client[ i ] )) { this.xml = new ActiveXObject( client[ i ] ); break; } } } catch( e ) { this.xml = 0; } } } catch( er ) { if ( "createRequest" in window ) this.xml = createRequest(); else this.xml = 0; } return (( this.xml ) ? this.xml : 0 ); } )(); if ( this.xmlDoc ) { this.createRequest = ( function( xhr, loc, method ) { (( "overrideMimeType" in xhr ) ? xhr.overrideMimeType("text/xml") : xhr ); xhr.onreadystatechange = handleMyRequest; xhr.open( method, encodeURI( loc ), true ); (( method === "POST" && "setRequestHeader" in xhr ) ? xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;") : xhr ); xhr.send((( method === "POST" ) ? " " : null )); } )( this.xmlDoc, this.url, this.method ); } return this.createRequest; }; onload = function() { new XHR( "home" ); // Your query string... }
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://127.0.0.1/tablesniper/js/sniperlib.js :: anonymous :: line 46" data: no]
xhr.open( method, encodeURI( loc ), true );
var check = ( Boolean((( XMLHttpRequest ) ? 1 : 0 ))); var handleMyRequest = function() { var seq = { 4 : "complete", complete : 4 }; if ( seq[ this.readyState ] ) { alert( this.responseText ); if ( this.status === 200 ) { (( check ) ? document.getElementById("greenBox") : document.all.greenBox ).innerHTML = this.responseText; } return; } alert("Request failed!\nPlease verify your QueryString..."); }; var XHR = function( loc ) { this.createRequest = null; this.loc = loc || null; this.url = "pageserver.php?loc=" + this.loc; this.xml = 0; var reqType = "GET"; this.xmlDoc = ( function() { try { if ( check ) { this.xml = new XMLHttpRequest(); } else { try { var client = [ "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ]; for ( var i = 0; i < client.length; ++i ) { if ( new ActiveXObject( client[ i ] )) { this.xml = new ActiveXObject( client[ i ] ); break; } } } catch( e ) { this.xml = 0; } } } catch( er ) { if ( "createRequest" in window ) this.xml = createRequest(); else this.xml = 0; } return (( this.xml ) ? this.xml : 0 ); } )(); if ( this.xmlDoc ) { this.createRequest = ( function( xhr, loc, method ) { (( "overrideMimeType" in xhr ) ? xhr.overrideMimeType("text/xml") : xhr ); xhr.onreadystatechange = handleMyRequest; xhr.open( method, loc, true ); (( method === "POST" && "setRequestHeader" in xhr ) ? xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;") : xhr ); xhr.send((( method === "POST" ) ? " " : null )); } )( this.xmlDoc, this.url, reqType ); } return this.createRequest; }; onload = function() { new XHR( "home" ); }
Error: no element found Source File: <a rel="nofollow" href="http://localhost/------r/pageserver.php?loc=Home" target="_blank">http://localhost/------r/pageserver.php?loc=Home</a> Line: 1
Error: junk after document element Source File: http://localhost/--------------r/pageserver.php?loc=home Line: 1, Column: 109 Source Code: <span id="leftBox" class="leftBox"><h4>############</h4><br />#############</span><span id="rightBox" class="rightBox"><h4>##############</h4> <br />###############</span>
| DaniWeb Message | |
| Cancel Changes | |