Re: Re: PHP output fails from AJAX call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Adarsh Sharma am Donnerstag, 30. Januar 2014 - 10:39:
>>> Thanks Nikha but its already dere :
>>> 
>>> <html>
>>> <head>
>>> <script>
>>> function week_report_fun(){
>>> var ajaxRequest;  // The variable that makes Ajax possible!
>>> 
>>> try{
>>>   // Opera 8.0+, Firefox, Safari
>>>   ajaxRequest = new XMLHttpRequest();
>>> }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;
>>>      }
>>>   }
>>> }
>>> ajaxRequest.onreadystatechange = function(){
>>>   if(ajaxRequest.readyState == 4){
>>>      var ajaxDisplay = document.getElementById('ajaxDiv');
>>>      ajaxDisplay.innerHTML = ajaxRequest.responseText;
>>>   }
>>> }
>>> var users = document.getElementById('users').value;
>>> var queryString = "?users=" + users ;
>>> //document.write(queryString);
>>> ajaxRequest.open("GET","ajaxex.php?q="+users,true);
>>> ajaxRequest.send();
>>> }
>>> 
>>> </script>
>>> </head>
>>> <body>
>>> 
>>> <form>
>>> User : <select id="users">
>>> <option value="">Select a user</option>
>>> <option value="133">a.v</option>
>>> <option value="168">ad</option>
>>> </select>
>>> <input type='button' onclick="week_report_fun()"
>>>                             value='Weekly Report'/>
>>> </form>
>>> <br>
>>> 
>>> </body>
>>> </html>

I see no ajaxDiv in your HTML.

If you’re not using the developer console on your chosen browser (or an extension that provides that functionality, e.g. FireBug for Firefox) then you should be. JS raises errors like any other language, so if something is going wrong that will tell you all about it.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux