Re: Re: PHP output fails from AJAX call
| From: | Stuart Dallas | Date: | Thu, 30 Jan 2014 14:30:25 +0000 |
| Subject: | Re: Re: PHP output fails from AJAX call | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322780@lists.php.net to get a copy of this message | ||
Please familiarise yourself with the console in your browser. If you’re using Safari or Chrome
there is a developer console built in, and if using Firefox I recommend installing Firebug. This
error, and any others in your Javascript will be displayed in the console and this whole mailing
list conversation could have been avoided.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
On 30 Jan 2014, at 13:57, Adarsh Sharma <eddy.adarsh@gmail.com> wrote:
> Thanks Stuart , issue is fixed. You got the root cause.
>
> Reports are coming now.
>
> Thanks
>
>
> On Thu, Jan 30, 2014 at 7:19 PM, Adarsh Sharma <eddy.adarsh@gmail.com> wrote:
> Hi Stuart,
>
> Please check below , ajaxDiv is at the end :-
>
> [root@]# cat index.html
> <html>
> <head>
> <center><h1> OTRS Analysis </h1>
>
>
> <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;
> }
> }
> }
> // Create a function that will receive data
> // sent from the server and will update
> // div section in the same page.
> ajaxRequest.onreadystatechange = function(){
> if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
>
> var ajaxDisplay = document.getElementById('ajaxDiv');
> ajaxDisplay.innerHTML = ajaxRequest.responseText;
> }
> }i
> var users = document.getElementById('users').value;
> var queryString = "?users=" + users ;
>
> //document.write(users);
>
> 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">an</option>
>
> <option value="168">ad</option>
> <option value="78">sou</option>
>
> </select>
> <input type='button' onclick="week_report_fun()"
> value='Weekly Report'/>
> </form>
> <div id='ajaxDiv'>Your result will display here</div>
> </body>
> </html>
>
>
> Please let me know if anything else is required
>
> Thanks
>