Jump to content

Some Ajax Questions


kensbeijing

Recommended Posts

Yea that's what I meant, I didn't think of that, thanks.
At the moment all I am doing with AJAX is changing the "php include" page when I press a link. Isn't there a way of doing this without AJAX, is there a javascript version of "include"? Because I want to use AJAX within the PHP pages which I included, so basically AJAX inside AJAX and its getting too complicated.
Link to comment
Share on other sites

Since PHP runs on the server and has access to all your files, while AJAX runs on the browser, NO, there is no real javascript equivalent of a PHP include.AJAX is as close as it comes. With AJAX, you can start with an empty page element (usually a div). Your AJAX object asks the server for some data. When the AJAX object receives the data, you can put it inside the element.As you saw in my example, one way that PHP can generate the response data is through an include statement. It's not the only way, but it's good if you want to return a bunch of text or HTML. "I want to use AJAX within the PHP pages . . ." sounds a little off. If you mean you want to use AJAX in an HTML document that is generated by PHP, okay. That works. If you're discussing a PHP script that responds to an AJAX request, that makes sense too.Where exactly are you lost? Post some code. Tell us what you want to happen and what really happens that shouldn't.

Link to comment
Share on other sites

Since PHP runs on the server and has access to all your files, while AJAX runs on the browser, NO, there is no real javascript equivalent of a PHP include.AJAX is as close as it comes. With AJAX, you can start with an empty page element (usually a div). Your AJAX object asks the server for some data. When the AJAX object receives the data, you can put it inside the element.As you saw in my example, one way that PHP can generate the response data is through an include statement. It's not the only way, but it's good if you want to return a bunch of text or HTML. "I want to use AJAX within the PHP pages . . ." sounds a little off. If you mean you want to use AJAX in an HTML document that is generated by PHP, okay. That works. If you're discussing a PHP script that responds to an AJAX request, that makes sense too.Where exactly are you lost? Post some code. Tell us what you want to happen and what really happens that shouldn't.
It's all working fine as far as I can see but.... oh wait actually iv got an idea, i'll get back to you when im in trouble. I'm beginning to get the hang of this so called javascript.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...