|
Posted by Ron Barnett on 09/08/07 11:39
"Erwin Moller"
<Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> wrote in
message news:46e14ec1$0$232$e4fe514c@news.xs4all.nl...
> Ron Barnett wrote:
>> "Norman Peelman" <npeelman@cfl.rr.com> wrote in message
>> news:46df3cfc$0$4036$4c368faf@roadrunner.com...
>>> Ron Barnett wrote:
>>>> Can anyone advise if I need to set up anything special before I can run
>>>> an AJAX application on a PHP enabled Apache server ?
>>>>
>>>> I have tried demo code and just get no response, its as if the PHP code
>>>> isn't getting called.
>>>> Normal PHP apps work fine, and regular JavaScript works fine -
>>>> mouseovers, submit buttons etc
>>>> It is as if there is an extension missing
>>>> Any suggestions
>>>>
>>>>
>>>>
>>>>
>>> You need to check the configuration of your AJAX package. SOme are
>>> easier than others... I use XAJAX, very easy to understand.
>>>
>>> Norm
>>
>> Ajax package ? could this be the missing link ?
>
> Hi,
>
> You don't need a AJAX packages at all.
> I would even suggest you get the thing up and running before diving into
> AJAX libs.
>
> A good place to start is www.w3schools.com.
> Use their simple browser-independent version to get the xmlhttp object,
> and use that for testing.
>
> function GetXmlHttpObject()
> {
> var xmlHttp=null;
> try
> {
> // Firefox, Opera 8.0+, Safari
> xmlHttp=new XMLHttpRequest();
> }
> catch (e)
> {
> // Internet Explorer
> try
> {
> xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
> }
> catch (e)
> {
> xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
> }
> }
> return xmlHttp;
> }
>
> And make a simple PHP page, like this:
> <?php
> echo ((int)$_GET["number"])*2;
> ?>
>
> Call it from browser:
> http://www.example.com/test.php?number=4
>
> It should answer 8.
>
> If that works, try implementing the AJAX logic, like described at
> www.w3schools.com.
>
> Remember AJAX is nothing more then a way of getting data from a server
> into your webpage via javascript. No reload of the page needed.
>
> Regards,
> Erwin Moller
>
>> Is XAJAX something that is installed on the server to support the scripts
>> (say an extension library in PHP.conf) or is it just part of the scripts
>> themselves - like a class library?
>>
>> Cheers
>>
>> Ron
Thank Erwin,
I've finally got something working. I had been getting all sorts of script
errors about missing objects - and PHP errors about bad syntax and illegal
operations in libraries that had to be good, so I was very confused.
Your reference to W3Schools.com was very useful, at first I started hitting
similar problems, then I realised that copy and pasting script examples
sometimes put executable code on the same line as a comment and it became
commented out, once I updated myself with the try/catch syntax and got the
line breaks sorted out it all fell into place.
Thanks again,
Ron
[Back to original message]
|