Re: [PHP] AJAX and PHP
tedd wrote: At 12:10 PM +0200 10/4/08, Alain Roger wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Alain: The only difference the user experiences between having AJAX, or not, is refreshing the page. If page refresh is not a problem, then don't complicate your life. On the other hand, if page refresh is annoying, or not wanted, then AJAX is you're only solution. But as it has been said before, not all users have javascript turned on and as such AJAX will not work -- after all, it javascript. However, there are way to degrade gracefully from a AJAX site to a normal site. Google javascript graceful degradation for references. Please note, going the AJAX route does not make your coding simpler -- it's a different critter. But it does (with help from jQuery et al) offer exciting new ways to present data. Cheers, tedd this is a standard response for me recently; but have you looked in to using flex 3 to build the clientside? additionally ajax's main benefit (in my mind) is that it allows you to pull down/update only the data you need, and not the whole page - often this means you can skip out a large part of the templating and make the php server side scripts so much lighter; very beneficial when polling. Other than that, as everyone has mentioned - it's mainly a cosmetic thing. -- nathan ( [EMAIL PROTECTED] ) { Senior Web Developer php + java + flex + xmpp + xml + ecmascript web development edinburgh | http://kraya.co.uk/ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
Alain: The only difference the user experiences between having AJAX, or not, is refreshing the page. If page refresh is not a problem, then don't complicate your life. On the other hand, if page refresh is annoying, or not wanted, then AJAX is you're only solution. But as it has been said before, not all users have javascript turned on and as such AJAX will not work -- after all, it javascript. However, there are way to degrade gracefully from a AJAX site to a normal site. Google javascript graceful degradation for references. Please note, going the AJAX route does not make your coding simpler -- it's a different critter. But it does (with help from jQuery et al) offer exciting new ways to present data. Cheers, tedd this is a standard response for me recently; but have you looked in to using flex 3 to build the clientside? additionally ajax's main benefit (in my mind) is that it allows you to pull down/update only the data you need, and not the whole page - often this means you can skip out a large part of the templating and make the php server side scripts so much lighter; very beneficial when polling. Other than that, as everyone has mentioned - it's mainly a cosmetic thing. -- nathan ( [EMAIL PROTECTED] ) Without mixing themes (flex in PHP forum) flex is similar to AS3, no ?
Re: [PHP] AJAX and PHP
Alain Roger wrote: Alain: The only difference the user experiences between having AJAX, or not, is refreshing the page. If page refresh is not a problem, then don't complicate your life. On the other hand, if page refresh is annoying, or not wanted, then AJAX is you're only solution. But as it has been said before, not all users have javascript turned on and as such AJAX will not work -- after all, it javascript. However, there are way to degrade gracefully from a AJAX site to a normal site. Google javascript graceful degradation for references. Please note, going the AJAX route does not make your coding simpler -- it's a different critter. But it does (with help from jQuery et al) offer exciting new ways to present data. Cheers, tedd this is a standard response for me recently; but have you looked in to using flex 3 to build the clientside? additionally ajax's main benefit (in my mind) is that it allows you to pull down/update only the data you need, and not the whole page - often this means you can skip out a large part of the templating and make the php server side scripts so much lighter; very beneficial when polling. Other than that, as everyone has mentioned - it's mainly a cosmetic thing. -- nathan ( [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ) Without mixing themes (flex in PHP forum) flex is similar to AS3, no ? yes, flex is flash for developers; the main language is AS3 and it outputs swf's; flex is basically a program which allows you to use mix of pre-made ui elements classes, css and AS3 to quickly make great RIA's. -- nathan ( [EMAIL PROTECTED] ) { Senior Web Developer php + java + flex + xmpp + xml + ecmascript web development edinburgh | http://kraya.co.uk/ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
!-- SNIP -- yes, flex is flash for developers; the main language is AS3 and it outputs swf's; flex is basically a program which allows you to use mix of pre-made ui elements classes, css and AS3 to quickly make great RIA's. Yup, but you have to have flash enabled. But some of us don't except for specific sites due to ads being swfs as well. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
And AFAIK it does not work on linux platform On Mon, Oct 6, 2008 at 3:36 PM, Wolf [EMAIL PROTECTED] wrote: !-- SNIP -- yes, flex is flash for developers; the main language is AS3 and it outputs swf's; flex is basically a program which allows you to use mix of pre-made ui elements classes, css and AS3 to quickly make great RIA's. Yup, but you have to have flash enabled. But some of us don't except for specific sites due to ads being swfs as well. Wolf -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
mailto:[EMAIL PROTECTED] wrote: !-- SNIP -- yes, flex is flash for developers; the main language is AS3 and it outputs swf's; flex is basically a program which allows you to use mix of pre-made ui elements classes, css and AS3 to quickly make great RIA's. Yup, but you have to have flash enabled. But some of us don't except for specific sites due to ads being swfs as well. Wolf Alain Roger wrote: And AFAIK it does not work on linux platform development wise adobe flex 3 SDK works on linux; afaik flex builder (the wysiwyg ide for eclipse) doesn't yet. clientside (the apps you develop) work anywhere flash player 9 does. a great reason to get in to flex now is that flex 4 will also be supporting most of the major smartphones so you're app's will work virtually everywhere (and look nicer + dev time wayyy down). can you tell I like it? (+it's got native E4X support) -- nathan ( [EMAIL PROTECTED] ) { Senior Web Developer php + java + flex + xmpp + xml + ecmascript web development edinburgh | http://kraya.co.uk/ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
On Oct 4, 2008, at 7:38 AM, Ashley Sheridan wrote: On Sat, 2008-10-04 at 13:48 +0200, Nitsan Bin-Nun wrote: It depends how much stuff you have in the first div, it there are a lot of images and the user will have to load them again (in case there is no cache) and you care for the traffic those images cost - it would be better to use AJAX. But generally - they both okay, I personally would use reload of the whole page just because of the time it would take me to develop it with ajax ;) HTH, Nitsan On Sat, Oct 4, 2008 at 12:10 PM, Alain Roger [EMAIL PROTECTED] wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 Also, it depends on who you think will be visiting the site, as an increasing number of people browse the web with devices that have no JavaScript capabilities, so they wouldn't be able to use an Ajax site. Jump into the now. As an increasing number of people browse the web with (handheld?) devices, the support will also increase. However, it also depends on the audience you're trying to reach. IMO, I wouldn't limit your site for the few who a) don't have js enabled or b) have a device that doesn't support any standard web browser features anyway. ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
On Mon, 2008-10-06 at 17:09 +0200, Alain Roger wrote: And AFAIK it does not work on linux platform On Mon, Oct 6, 2008 at 3:36 PM, Wolf [EMAIL PROTECTED] wrote: !-- SNIP -- yes, flex is flash for developers; the main language is AS3 and it outputs swf's; flex is basically a program which allows you to use mix of pre-made ui elements classes, css and AS3 to quickly make great RIA's. Yup, but you have to have flash enabled. But some of us don't except for specific sites due to ads being swfs as well. Wolf It can be made to work, but there is a lot of messing about. Not tried it myself, but I have spoken to some people on the Papervision team who have done it. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] AJAX and PHP
HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
It depends how much stuff you have in the first div, it there are a lot of images and the user will have to load them again (in case there is no cache) and you care for the traffic those images cost - it would be better to use AJAX. But generally - they both okay, I personally would use reload of the whole page just because of the time it would take me to develop it with ajax ;) HTH, Nitsan On Sat, Oct 4, 2008 at 12:10 PM, Alain Roger [EMAIL PROTECTED] wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
On Sat, 2008-10-04 at 13:48 +0200, Nitsan Bin-Nun wrote: It depends how much stuff you have in the first div, it there are a lot of images and the user will have to load them again (in case there is no cache) and you care for the traffic those images cost - it would be better to use AJAX. But generally - they both okay, I personally would use reload of the whole page just because of the time it would take me to develop it with ajax ;) HTH, Nitsan On Sat, Oct 4, 2008 at 12:10 PM, Alain Roger [EMAIL PROTECTED] wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 Also, it depends on who you think will be visiting the site, as an increasing number of people browse the web with devices that have no JavaScript capabilities, so they wouldn't be able to use an Ajax site. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
On Sat, Oct 4, 2008 at 2:38 PM, Ashley Sheridan [EMAIL PROTECTED]wrote: On Sat, 2008-10-04 at 13:48 +0200, Nitsan Bin-Nun wrote: It depends how much stuff you have in the first div, it there are a lot of images and the user will have to load them again (in case there is no cache) and you care for the traffic those images cost - it would be better to use AJAX. But generally - they both okay, I personally would use reload of the whole page just because of the time it would take me to develop it with ajax ;) HTH, Nitsan On Sat, Oct 4, 2008 at 12:10 PM, Alain Roger [EMAIL PROTECTED] wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 Also, it depends on who you think will be visiting the site, as an increasing number of people browse the web with devices that have no JavaScript capabilities, so they wouldn't be able to use an Ajax site. AFAIK only PDA do no have javascript support at 100%. MacOS, MS OS and LINUX support it.
Re: [PHP] AJAX and PHP
On Sat, 2008-10-04 at 14:41 +0200, Alain Roger wrote: On Sat, Oct 4, 2008 at 2:38 PM, Ashley Sheridan [EMAIL PROTECTED]wrote: On Sat, 2008-10-04 at 13:48 +0200, Nitsan Bin-Nun wrote: It depends how much stuff you have in the first div, it there are a lot of images and the user will have to load them again (in case there is no cache) and you care for the traffic those images cost - it would be better to use AJAX. But generally - they both okay, I personally would use reload of the whole page just because of the time it would take me to develop it with ajax ;) HTH, Nitsan On Sat, Oct 4, 2008 at 12:10 PM, Alain Roger [EMAIL PROTECTED] wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 Also, it depends on who you think will be visiting the site, as an increasing number of people browse the web with devices that have no JavaScript capabilities, so they wouldn't be able to use an Ajax site. AFAIK only PDA do no have javascript support at 100%. MacOS, MS OS and LINUX support it. I meant mobile devices mainly, which tend not to support scripting. Also, JavaScript can be turned off on a browser, and in some workplaces, proxy servers have been known to strip out script from a page. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
At 12:10 PM +0200 10/4/08, Alain Roger wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Alain: The only difference the user experiences between having AJAX, or not, is refreshing the page. If page refresh is not a problem, then don't complicate your life. On the other hand, if page refresh is annoying, or not wanted, then AJAX is you're only solution. But as it has been said before, not all users have javascript turned on and as such AJAX will not work -- after all, it javascript. However, there are way to degrade gracefully from a AJAX site to a normal site. Google javascript graceful degradation for references. Please note, going the AJAX route does not make your coding simpler -- it's a different critter. But it does (with help from jQuery et al) offer exciting new ways to present data. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
Thanks tedd. basically page refreshin is not a problem for me as it in intranet application. however, AJAX offers some really nice thing and 1 from my point of view it's to reduce the network traffic by limiting what should be refresh/downloaded. in that way i think it is interesting. On Sat, Oct 4, 2008 at 3:52 PM, tedd [EMAIL PROTECTED] wrote: At 12:10 PM +0200 10/4/08, Alain Roger wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Alain: The only difference the user experiences between having AJAX, or not, is refreshing the page. If page refresh is not a problem, then don't complicate your life. On the other hand, if page refresh is annoying, or not wanted, then AJAX is you're only solution. But as it has been said before, not all users have javascript turned on and as such AJAX will not work -- after all, it javascript. However, there are way to degrade gracefully from a AJAX site to a normal site. Google javascript graceful degradation for references. Please note, going the AJAX route does not make your coding simpler -- it's a different critter. But it does (with help from jQuery et al) offer exciting new ways to present data. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
At 5:39 PM +0200 10/4/08, Alain Roger wrote: Thanks tedd. basically page refreshin is not a problem for me as it in intranet application. however, AJAX offers some really nice thing and 1 from my point of view it's to reduce the network traffic by limiting what should be refresh/downloaded. A small clarification as per my understanding -- using AJAX does not limit what should be downloaded -- what needs to be downloaded, needs to be downloaded regardless. However, using AJAX does change how the browser refreshes and cuts down the chatter between the server and client. An AJAX request (GET or POST) is simply done behind the browser's back -- if something needs to be brought forward from the server to the client then it makes no difference if you use AJAX or the standard way. In either case, it requires download time and server contact. If you are not using AJAX, then the browser simply refreshes the entire page with what it has cached and goes to the server for what it hasn't. With AJAX, AJAX simply tells the browser what to refresh and leaves the remainder alone. As I said, using AJAX will cut down on the chatter between the server and client, but that chatter is not reloading everything each time. So, AJAX is not really affecting downloads -- those are determined by the needs of the page and not on the manner of the presentation. Now, one can argue that any contact is downloading and I guess that is technically correct. But I am saying that communication between the server and client is different depending upon what's been cached. It's a bit like my wife calling her sister. If my wife gets the answering service, she leaves a message -- if not they talk. While one can say that a call has been made and received in either case, the amount transmitted is significantly different if her sister answers -- if you get my drift. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
Alain Roger wrote: Thanks tedd. basically page refreshin is not a problem for me as it in intranet application. however, AJAX offers some really nice thing and 1 from my point of view it's to reduce the network traffic by limiting what should be refresh/downloaded. in that way i think it is interesting. On an intranet you've almost certainly got 100Mbit/s with a suitably capable backbone - limiting network traffic is not a concern, IMHO. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
So in this case what is the plus for companies like MS, Google (with Gmail), flicker and so on to use AJAX ? it is on internet, so i guess they have a purpose to do that. mine is to have a responsive and intuitive interface application whatever it is on internet or intranet. On Sat, Oct 4, 2008 at 7:12 PM, Per Jessen [EMAIL PROTECTED] wrote: Alain Roger wrote: Thanks tedd. basically page refreshin is not a problem for me as it in intranet application. however, AJAX offers some really nice thing and 1 from my point of view it's to reduce the network traffic by limiting what should be refresh/downloaded. in that way i think it is interesting. On an intranet you've almost certainly got 100Mbit/s with a suitably capable backbone - limiting network traffic is not a concern, IMHO. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
On Sat, 2008-10-04 at 13:38 +0100, Ashley Sheridan wrote: On Sat, 2008-10-04 at 13:48 +0200, Nitsan Bin-Nun wrote: It depends how much stuff you have in the first div, it there are a lot of images and the user will have to load them again (in case there is no cache) and you care for the traffic those images cost - it would be better to use AJAX. But generally - they both okay, I personally would use reload of the whole page just because of the time it would take me to develop it with ajax ;) HTH, Nitsan On Sat, Oct 4, 2008 at 12:10 PM, Alain Roger [EMAIL PROTECTED] wrote: HI, i'm currently working on some web application and i would like to know what is the best way to do what i want. basically like all application i have a menu and based on selected item menu i want to display a page (basically 50 % of this new page is DB result/grid. As usual i have 2 divs, one for the menu one for the content of DB to display. i would like to know if it's not better to use AJAX to load the content of the second div (DB result and other stuff) instead to every time load a new page which load menu and content of DB ? what are your experiences on such thing ? thx. -- Alain Windows XP SP3 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 Also, it depends on who you think will be visiting the site, as an increasing number of people browse the web with devices that have no JavaScript capabilities, so they wouldn't be able to use an Ajax site. So just engineer the AJAX so it falls back to traditional full page reload when JavaScript is disabled. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
Alain Roger wrote: So in this case what is the plus for companies like MS, Google (with Gmail), flicker and so on to use AJAX ? For them (and others), it's about the user experience, and ajax is good at enhancing the user experience. it is on internet, so i guess they have a purpose to do that. mine is to have a responsive and intuitive interface application whatever it is on internet or intranet. Now you are changing the rules - they are very different on the internet. My advice - don't use ajax in an attempt to reduce network traffic. Use it to enhance the user experience. Caching is much better at reducing network atraffic anyway. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
Per Jessen wrote: Alain Roger wrote: So in this case what is the plus for companies like MS, Google (with Gmail), flicker and so on to use AJAX ? For them (and others), it's about the user experience, and ajax is good at enhancing the user experience. it is on internet, so i guess they have a purpose to do that. mine is to have a responsive and intuitive interface application whatever it is on internet or intranet. Now you are changing the rules - they are very different on the internet. My advice - don't use ajax in an attempt to reduce network traffic. Use it to enhance the user experience. Caching is much better at reducing network atraffic anyway. /Per Jessen, Zürich If it's the size of the page itself that is large, caching does not help as the HTML is pulled everytime if something is different. As for AJAX, check out http://xajaxproject.org It makes AJAX really easy to code. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] AJAX and PHP
Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
Quoting Alain Roger [EMAIL PROTECTED]: Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Making an Ajax request for one little label maybe a bit overkill. As i understand you request the whole form through an Ajax request. And display this to the user? And every language generates a new form? Why not just create the form dynamically with javascript and load the data from PHP. So the form can stay the same for all calls. You just fill it with data depending on the language selected. You can fill the form for instance by sending a JSON encoded object from PHP to javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
you understood right. basically my problem is that the layout avoid it. here is something like my layout : div#0 div#1Lanague (label) : img flag img arrow to show all languages from div#2/div#1 div#2 all flags/div#2 div#3 login field + pwd field + submit button/div#3 /div#0 till now i only use AJAX to refresh the content of div#3 but it does not change the label from div#1 when user selects another language from div#2. if i place the whole form into a PHP i face several questions : - how the ajax will reload this PHP page (reloading itself) in the parent control div#0 ? - when user will click on submit button, where will be loaded the content return of checking if log+pwd are correct ? - how to redirect to another PHP page, when user click on submit button ? the redirection will happen only in the content div, so only in div#0 and not into the browser :-( Al. On Mon, Apr 21, 2008 at 9:55 AM, Thijs Lensselink [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Making an Ajax request for one little label maybe a bit overkill. As i understand you request the whole form through an Ajax request. And display this to the user? And every language generates a new form? Why not just create the form dynamically with javascript and load the data from PHP. So the form can stay the same for all calls. You just fill it with data depending on the language selected. You can fill the form for instance by sending a JSON encoded object from PHP to javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
in fact i meant by redirecting the following thing : - if user wrote a correct pwd and login, the system should redirect [using header(Location ] syntax to launch the application. but if i use such syntax it will be redirected only into the div#0, and not in the browser itslef. is it clearer now ? On Mon, Apr 21, 2008 at 11:40 AM, Thijs Lensselink [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: you understood right. basically my problem is that the layout avoid it. here is something like my layout : div#0 div#1Lanague (label) : img flag img arrow to show all languages from div#2/div#1 div#2 all flags/div#2 div#3 login field + pwd field + submit button/div#3 /div#0 till now i only use AJAX to refresh the content of div#3 but it does not change the label from div#1 when user selects another language from div#2. Well it looks like you need a extra Ajax call to the server. Click a language flag sends a request to the server. The server responds with an JSON object. Containing the content for div#2. With javascript you can update the contents of div#2 if i place the whole form into a PHP i face several questions : - how the ajax will reload this PHP page (reloading itself) in the parent control div#0 ? If you would like to reload the whole of div#0 You could send and JSON object from PHP to javascript. And let javascript generate the div structure and update the DOM. - when user will click on submit button, where will be loaded the content return of checking if log+pwd are correct ? When a user logs in a Ajax request is send to the server. the server responds with an JSON object containing the error message. With javascript you could update the contents of div#3 to display a message. - how to redirect to another PHP page, when user click on submit button ? the redirection will happen only in the content div, so only in div#0 and not into the browser :-( I have a hard time understanding this last issue. What exactly do you mean by redirecting to another PHP page? Al. On Mon, Apr 21, 2008 at 9:55 AM, Thijs Lensselink [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Making an Ajax request for one little label maybe a bit overkill. As i understand you request the whole form through an Ajax request. And display this to the user? And every language generates a new form? Why not just create the form dynamically with javascript and load the data from PHP. So the form can stay the same for all calls. You just fill it with data depending on the language selected. You can fill the form for instance by sending a JSON encoded object from PHP to javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
Quoting Alain Roger [EMAIL PROTECTED]: in fact i meant by redirecting the following thing : - if user wrote a correct pwd and login, the system should redirect [using header(Location ] syntax to launch the application. but if i use such syntax it will be redirected only into the div#0, and not in the browser itslef. is it clearer now ? It's crystal clear :) I guess you could do it in two ways. Firstly without a redirect. You could just use javascript and CSS to show some sort of error message. Reload the form in the div. And give the user another try to login. If you really want a reload. You have to do it with javascript. You could let PHP send back a status to javascript. And based on that. Either load a div with content. Or do a document.location = ''; Hope it helps. On Mon, Apr 21, 2008 at 11:40 AM, Thijs Lensselink [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: you understood right. basically my problem is that the layout avoid it. here is something like my layout : div#0 div#1Lanague (label) : img flag img arrow to show all languages from div#2/div#1 div#2 all flags/div#2 div#3 login field + pwd field + submit button/div#3 /div#0 till now i only use AJAX to refresh the content of div#3 but it does not change the label from div#1 when user selects another language from div#2. Well it looks like you need a extra Ajax call to the server. Click a language flag sends a request to the server. The server responds with an JSON object. Containing the content for div#2. With javascript you can update the contents of div#2 if i place the whole form into a PHP i face several questions : - how the ajax will reload this PHP page (reloading itself) in the parent control div#0 ? If you would like to reload the whole of div#0 You could send and JSON object from PHP to javascript. And let javascript generate the div structure and update the DOM. - when user will click on submit button, where will be loaded the content return of checking if log+pwd are correct ? When a user logs in a Ajax request is send to the server. the server responds with an JSON object containing the error message. With javascript you could update the contents of div#3 to display a message. - how to redirect to another PHP page, when user click on submit button ? the redirection will happen only in the content div, so only in div#0 and not into the browser :-( I have a hard time understanding this last issue. What exactly do you mean by redirecting to another PHP page? Al. On Mon, Apr 21, 2008 at 9:55 AM, Thijs Lensselink [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Making an Ajax request for one little label maybe a bit overkill. As i understand you request the whole form through an Ajax request. And display this to the user? And every language generates a new form? Why not just create the form dynamically with javascript and load the data from PHP. So the form can stay the same for all calls. You just fill it with data depending on the language selected. You can fill the form for instance by sending a JSON encoded object from PHP to javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- PHP General Mailing List (http
Re: [PHP] AJAX and PHP
Hi Alain, You can create a mini-db with XML, that contains translations for each of the words you need (if there are 10 words, 50 langs, you got 500 records.. small and useful). HTH, Nitsan On 21/04/2008, Alain Roger [EMAIL PROTECTED] wrote: Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] AJAX and PHP
Quoting Alain Roger [EMAIL PROTECTED]: you understood right. basically my problem is that the layout avoid it. here is something like my layout : div#0 div#1Lanague (label) : img flag img arrow to show all languages from div#2/div#1 div#2 all flags/div#2 div#3 login field + pwd field + submit button/div#3 /div#0 till now i only use AJAX to refresh the content of div#3 but it does not change the label from div#1 when user selects another language from div#2. Well it looks like you need a extra Ajax call to the server. Click a language flag sends a request to the server. The server responds with an JSON object. Containing the content for div#2. With javascript you can update the contents of div#2 if i place the whole form into a PHP i face several questions : - how the ajax will reload this PHP page (reloading itself) in the parent control div#0 ? If you would like to reload the whole of div#0 You could send and JSON object from PHP to javascript. And let javascript generate the div structure and update the DOM. - when user will click on submit button, where will be loaded the content return of checking if log+pwd are correct ? When a user logs in a Ajax request is send to the server. the server responds with an JSON object containing the error message. With javascript you could update the contents of div#3 to display a message. - how to redirect to another PHP page, when user click on submit button ? the redirection will happen only in the content div, so only in div#0 and not into the browser :-( I have a hard time understanding this last issue. What exactly do you mean by redirecting to another PHP page? Al. On Mon, Apr 21, 2008 at 9:55 AM, Thijs Lensselink [EMAIL PROTECTED] wrote: Quoting Alain Roger [EMAIL PROTECTED]: Hi, i'm playing around with AJAX and PHP to create something like a small desktop application. basically the first step is to log in the system. for that i have a log-in form where users can choose the interface language. here is my problem : when the log-in form runs, it is in English. user can click on some arrow to open another DIV and display all other languages available. a click on a particular flag, will call the PHP page where the log-in form (login field + password field) are stored with dynamic language interface. however, i make no sense for the title of this form to call a PHP page where will be just 1 dynamic text (changing on flag choice). so if you understand well, i have 2 divs (1 for form title, 1 for log-in form itself). and i load thanks AJAX php code into divs. my problem is that i do not want to write a PHP page just for 1 label... it makes sense for a complete form but not for a simple text line or label. So how can i do that without refreshing page. using AJAX and PHP only ? i guess you already faced such situation so i would really appreciate your help. thanks a lot, -- Alain Making an Ajax request for one little label maybe a bit overkill. As i understand you request the whole form through an Ajax request. And display this to the user? And every language generates a new form? Why not just create the form dynamically with javascript and load the data from PHP. So the form can stay the same for all calls. You just fill it with data depending on the language selected. You can fill the form for instance by sending a JSON encoded object from PHP to javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ajax and PHP: XMLHTTP
Micky Hulse wrote: ?=$_SERVER['PHP_SELF']? Can I replace the above with some sort of XMLHTTP request? As noted, that's a javascript question. However your PHP code is vulnerable to XSS attacks; you should at least encode the output with htmlspecialchars() so that URLs like foo.php/scriptalert('hi');/script are safe. eg. ?php echo htmlspecialchars($_SERVER['PHP_SELF']); ? Arpad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ajax and PHP: XMLHTTP
?=$_SERVER['PHP_SELF']? Can I replace the above with some sort of XMLHTTP request? Googling now... thought I would ask here first. Any good links to tuts that might cover that sort of thing? Kinda thinking about plugging some Ajax into a random image php script. TIA. :) Cheers, Micky -- Wishlist: http://snipurl.com/vrs9 Switch: http://browsehappy.com/ BCC?: http://snipurl.com/w6f8 My: http://del.icio.us/mhulse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php