Rey Bango schrieb:
> Hi Mark,
> 
> I threw up some code so you can see a very simple Ajax call that should 
> help you out:
> 
> http://www.intoajax.com/harwood.htm
> 
> Look at the source and the comments will explain whats happening.
> 
> As for php, one of the community members, Mike Alsup, helped me out with 
> an issue and he sent me a php file. In that, he set the content-type of 
> the document by using this line:
> 
> <?php
>      header("Content-Type: text/html; charset=UTF-8");
> ?>
> 
> So you'll want to follow suit depending on what you're sending back.
> 
> HTH.

Here's another tip (to promote good practice right from the beginning): 
Every Ajax call by jQuery sends a  special request header, upon which 
you can decide what to do, i.e. deliver the complete page or deliver 
only a part in the response.
This is especially useful if you want to hijax your forms, so that they 
both work with and without Ajax/JavaScript.

You can check that in PHP like:

if ( $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest") {
     // handle XHR request

} else {
     // handle standard request

}

Cheers, Klaus






_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to