I want my AJAX responseText to return "ONLY" the data that I echo with PHP... at the moment it is returning full HTML pages, which I dont want and is making things impossible... How can I strip these HTML tags out and leave just my data? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
uhm, could it be that you are also echoing the header files that you are including in your php? write a php file that has <? echo "boo" ?> and call it with your ajax and all you should get is boo On 8/24/07, junkmate <junkmate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I want my AJAX responseText to return "ONLY" the data that I echo with > PHP... > at the moment it is returning full HTML pages, which I dont want and > is making things impossible... > > How can I strip these HTML tags out and leave just my data? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I run the following Javascript code, which calls a PHP file grabData.php, which contains ONLY <?php echo "boo"; ?> and the alert returned has an entire HTML structure with "boo" in the middle of it... Heres the code im using: if (navigator.appName == "Microsoft Internet Explorer") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { http = new XMLHttpRequest(); } http.abort(); http.open("GET", "grabData.php, true); http.onreadystatechange=function() { if(http.readyState == 4) { alert(http.responseText); } } http.send(null); On Aug 25, 2:13 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> uhm, could it be that you are also echoing the header files that you are > including in your php? > > write a php file that has > > <? echo "boo" ?> > > and call it with your ajax and all you should get is boo > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I want my AJAX responseText to return "ONLY" the data that I echo with > > PHP... > > at the moment it is returning full HTML pages, which I dont want and > > is making things impossible... > > > How can I strip these HTML tags out and leave just my data?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
what browser are you using? all i get back from the code is boo also: you are missing a " in http.open("GET", "grabData.php, true); here''s the working example http://sudev.bruuuuuce.com/hrmtest.htm On 8/24/07, junkmate <junkmate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I run the following Javascript code, which calls a PHP file > grabData.php, which contains ONLY <?php echo "boo"; ?> and the alert > returned has an entire HTML structure with "boo" in the middle of > it... Heres the code im using: > > if (navigator.appName == "Microsoft Internet Explorer") { > http = new ActiveXObject("Microsoft.XMLHTTP"); > } else { > http = new XMLHttpRequest(); > } > > http.abort(); > http.open("GET", "grabData.php, true); > http.onreadystatechange=function() { > if(http.readyState == 4) { > alert(http.responseText); > } > } > http.send(null); > > > > On Aug 25, 2:13 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > uhm, could it be that you are also echoing the header files that you are > > including in your php? > > > > write a php file that has > > > > <? echo "boo" ?> > > > > and call it with your ajax and all you should get is boo > > > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I want my AJAX responseText to return "ONLY" the data that I echo with > > > PHP... > > > at the moment it is returning full HTML pages, which I dont want and > > > is making things impossible... > > > > > How can I strip these HTML tags out and leave just my data? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yer it turned out to be the way I had my .htaccess file set up was preventing me from seeing what was actually wrong... Turns out you cant do XMLHttpRequest between different domains anyway... thats what was giving the errors, saying permission denied... (but I have my site set up so all invalid requests return an error page... which was what was being returned blah blah blah...) So I''m back to square one... How do the likes of Google Adsense and Twitter etc. include data with only Javascript snippets like this: <script type="text/javascript">var id="29x566c38e9bf";</script> <script type="text/javascript" src="grabData.js"></script> I want that script, running on a clients domain/website, to grab Data from my SQL database which can be found using the ID supplied... and then return a bunch of data from the database to the clients website, in place of the javascript tags (above) how?! :D On Aug 25, 3:22 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> what browser are you using? > > all i get back from the code is boo > > also: you are missing a " in http.open("GET", "grabData.php, true); > > here''s the working examplehttp://sudev.bruuuuuce.com/hrmtest.htm > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I run the following Javascript code, which calls a PHP file > > grabData.php, which contains ONLY <?php echo "boo"; ?> and the alert > > returned has an entire HTML structure with "boo" in the middle of > > it... Heres the code im using: > > > if (navigator.appName == "Microsoft Internet Explorer") { > > http = new ActiveXObject("Microsoft.XMLHTTP"); > > } else { > > http = new XMLHttpRequest(); > > } > > > http.abort(); > > http.open("GET", "grabData.php, true); > > http.onreadystatechange=function() { > > if(http.readyState == 4) { > > alert(http.responseText); > > } > > } > > http.send(null); > > > On Aug 25, 2:13 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > uhm, could it be that you are also echoing the header files that you are > > > including in your php? > > > > write a php file that has > > > > <? echo "boo" ?> > > > > and call it with your ajax and all you should get is boo > > > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I want my AJAX responseText to return "ONLY" the data that I echo with > > > > PHP... > > > > at the moment it is returning full HTML pages, which I dont want and > > > > is making things impossible... > > > > > How can I strip these HTML tags out and leave just my data?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
well first off google can have their web server set up to process js files as php, asp, html, txt, etc etc it''s a standard feature of apache secondly go to http://www.google-analytics.com/urchin.js and you should get the idea, they feed javascript to the browser. Your php will have to feed javascript to their browser. On 8/24/07, junkmate <junkmate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Yer it turned out to be the way I had my .htaccess file set up was > preventing me from seeing what was actually wrong... > > Turns out you cant do XMLHttpRequest between different domains > anyway... thats what was giving the errors, saying permission > denied... (but I have my site set up so all invalid requests return an > error page... which was what was being returned blah blah blah...) > > So I''m back to square one... > How do the likes of Google Adsense and Twitter etc. include data with > only Javascript snippets like this: > <script type="text/javascript">var id="29x566c38e9bf";</script> > <script type="text/javascript" src="grabData.js"></script> > > I want that script, running on a clients domain/website, to grab Data > from my SQL database which can be found using the ID supplied... and > then return a bunch of data from the database to the clients website, > in place of the javascript tags (above) > > how?! :D > > > On Aug 25, 3:22 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > what browser are you using? > > > > all i get back from the code is boo > > > > also: you are missing a " in http.open("GET", "grabData.php, true); > > > > here''s the working examplehttp://sudev.bruuuuuce.com/hrmtest.htm > > > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I run the following Javascript code, which calls a PHP file > > > grabData.php, which contains ONLY <?php echo "boo"; ?> and the alert > > > returned has an entire HTML structure with "boo" in the middle of > > > it... Heres the code im using: > > > > > if (navigator.appName == "Microsoft Internet Explorer") { > > > http = new ActiveXObject("Microsoft.XMLHTTP"); > > > } else { > > > http = new XMLHttpRequest(); > > > } > > > > > http.abort(); > > > http.open("GET", "grabData.php, true); > > > http.onreadystatechange=function() { > > > if(http.readyState == 4) { > > > alert(http.responseText); > > > } > > > } > > > http.send(null); > > > > > On Aug 25, 2:13 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > uhm, could it be that you are also echoing the header files that you > are > > > > including in your php? > > > > > > write a php file that has > > > > > > <? echo "boo" ?> > > > > > > and call it with your ajax and all you should get is boo > > > > > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I want my AJAX responseText to return "ONLY" the data that I echo > with > > > > > PHP... > > > > > at the moment it is returning full HTML pages, which I dont want > and > > > > > is making things impossible... > > > > > > > How can I strip these HTML tags out and leave just my data? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yup, exactly right - It turned out to be annoyingly simple... <script src="..../something.php"></script> and in the PHP file, just have echo "document.write()"; sorted, thanks for your help! On Aug 25, 4:08 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> well first off google can have their web server set up to process js files > as php, asp, html, txt, etc etc it''s a standard feature of apache > > secondly go tohttp://www.google-analytics.com/urchin.js > > and you should get the idea, they feed javascript to the browser. > > Your php will have to feed javascript to their browser. > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Yer it turned out to be the way I had my .htaccess file set up was > > preventing me from seeing what was actually wrong... > > > Turns out you cant do XMLHttpRequest between different domains > > anyway... thats what was giving the errors, saying permission > > denied... (but I have my site set up so all invalid requests return an > > error page... which was what was being returned blah blah blah...) > > > So I''m back to square one... > > How do the likes of Google Adsense and Twitter etc. include data with > > only Javascript snippets like this: > > <script type="text/javascript">var id="29x566c38e9bf";</script> > > <script type="text/javascript" src="grabData.js"></script> > > > I want that script, running on a clients domain/website, to grab Data > > from my SQL database which can be found using the ID supplied... and > > then return a bunch of data from the database to the clients website, > > in place of the javascript tags (above) > > > how?! :D > > > On Aug 25, 3:22 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > what browser are you using? > > > > all i get back from the code is boo > > > > also: you are missing a " in http.open("GET", "grabData.php, true); > > > > here''s the working examplehttp://sudev.bruuuuuce.com/hrmtest.htm > > > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I run the following Javascript code, which calls a PHP file > > > > grabData.php, which contains ONLY <?php echo "boo"; ?> and the alert > > > > returned has an entire HTML structure with "boo" in the middle of > > > > it... Heres the code im using: > > > > > if (navigator.appName == "Microsoft Internet Explorer") { > > > > http = new ActiveXObject("Microsoft.XMLHTTP"); > > > > } else { > > > > http = new XMLHttpRequest(); > > > > } > > > > > http.abort(); > > > > http.open("GET", "grabData.php, true); > > > > http.onreadystatechange=function() { > > > > if(http.readyState == 4) { > > > > alert(http.responseText); > > > > } > > > > } > > > > http.send(null); > > > > > On Aug 25, 2:13 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > uhm, could it be that you are also echoing the header files that you > > are > > > > > including in your php? > > > > > > write a php file that has > > > > > > <? echo "boo" ?> > > > > > > and call it with your ajax and all you should get is boo > > > > > > On 8/24/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I want my AJAX responseText to return "ONLY" the data that I echo > > with > > > > > > PHP... > > > > > > at the moment it is returning full HTML pages, which I dont want > > and > > > > > > is making things impossible... > > > > > > > How can I strip these HTML tags out and leave just my data?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---