ts_ecommerce Posted March 2, 2010 Share Posted March 2, 2010 (edited) Hi: I'm working on adminitrative module that works with ajax. I have a simple php with "echo functions" and a javascript file that call that .php. I do this other times, but with oscommerce the "responseText" is the current page html code (with the changes). EDIT with some code: Admin page: <a class="refresh" href="#" title="refresh" onclick="fajax();return false;">Refresh</a> <div id="div_refresh">TEXT</div> JavaScript function: function fajax(){ var content_div_id = 'div_refresh'; contenedor = document.getElementById(content_div_id); if(contenedor == null) return false; contenedor.innerHTML = 'Loading...'; var source = 'folder/ajaxfunc.php'; //That folder in 'admin/includes' var xhr = "new XMLHttpRequest"; xhr.open('GET', source, false); xhr.send(''); contenedor.innerHTML = xhr.responseText; return xhr.responseText; } PHP file (ajaxfunc): <?php echo "REFRESH!!!"; ?> And, like I said, the "xhr.responseText" returns the current page html code with the changes, but I only want the php "echo". I don't understand. Another echo? Does anyone have any idea that could be happening? Thanks for your time and sorry for my english. Edited March 2, 2010 by ts_ecommerce Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.