balkan7 Posted January 14, 2009 Share Posted January 14, 2009 please help me data from clicked link. radio_panel.php <?php echo "<script type='text/javascript' src='radio.js'></script>"; openside("Radio"); echo "<table width='100%' cellpading='0' cellspacing='0' class='center'>\n<tr>\n"; echo "<td class='tbl1' witdh='50%'>Domasni</td>"; echo "<td class='tbl1' witdh='50%'><a href=\"javascript: page('stranski')\">Stranski</td>\n</tr>\n<tr>"; if (isset($_GET['page']) == "stranski"){ echo "<td class='tbl'><div id='radio'>Stranski radio stanici</div></td>"; } else { echo "<td class='tbl'>Domasni radio stanici</td>"; } echo "<tr>\n</table>\n"; closeside(); ?> and radio.js function getHTTPObject() { var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (!xmlhttp){ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP Object /* */ function page(radio) { http.abort(); http.open("GET", "radio_panel.php?page=" + radio, true); http.onreadystatechange = function() { if(http.readyState == 1) { // Loading indicator document.getElementById('radio').innerHTML = '<img src=\"images/loading.gif\">'; } if(http.readyState == 4) { document.getElementById('radio').innerHTML = http.responseText; http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", param.length); http.setRequestHeader("Connection", "close"); } } http.send(null); } Link to comment https://forums.phpfreaks.com/topic/140864-solved-get-data/ Share on other sites More sharing options...
xtopolis Posted January 15, 2009 Share Posted January 15, 2009 It looks like you're using POST headers http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", param.length); http.setRequestHeader("Connection", "close"); with a GET request. What happens if you remove those lines? Link to comment https://forums.phpfreaks.com/topic/140864-solved-get-data/#findComment-737394 Share on other sites More sharing options...
balkan7 Posted January 15, 2009 Author Share Posted January 15, 2009 i change js code but nothing happens ??? radio.js var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } function radio(page, DivID) { if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", "radio_panel.php?page=" + page, true); XMLHttpRequestObject.onreadystatechange = function() { if(XMLHttpRequestObject.readyState == 1) { // Loading indicator obj.innerHTML = '<img src=\"images/loading.gif\">'; } if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); } } and html <a href=\"javascript:radio('strasnki', 'show');\">Stranski</a> <div id='show'>show here!!!</div> Link to comment https://forums.phpfreaks.com/topic/140864-solved-get-data/#findComment-737715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.