Re: [jQuery] Jquery AJAXsubmit and cookie
and on the php side I just set the custom header by the header() function in PHP ? thanks, pranav. Ⓙⓐⓚⓔ wrote: > > I was looking around for an old test I did... can't find it .. > > but, the complete callback of the ajax call gives you the full > headers, and you can parse for the errors you want to send. > > when you realize that it needs a new login > window.location = "login.php" > and you are outta there! > > On 1/14/07, unohoo <[EMAIL PROTECTED]> wrote: >> >> That makes sense conceptually, but how to translate that to jquery code ? >> How >> to verify the returning header from the php file. and then redirect >> within >> jquery ? >> >> thanks, >> >> Ⓙⓐⓚⓔ wrote: >> > >> > yup you have to redirect them! you can look at the header, and see >> > that the response has a custom header that tells you to give up and >> > get a new password. >> > >> > You can't use the normal redirect because that would just return the >> > login page to the ajax request... but then you could realize that it's >> > the login page and then send them to the real login page. >> > >> > Does that make sense? >> > the pure xml way would be to return a different xml format with the >> > error message in it instead of the normal data. >> > >> > On 1/14/07, unohoo <[EMAIL PROTECTED]> wrote: >> >> >> >> I use the AJAXsubmit and ajaxform at a couple of places in my php app. >> >> So, >> >> when a user clicks on 'change privacy', a form with radio buttons >> appears >> >> to >> >> change privacy settings of photo. >> >> >> >> the form relies on ajaxsubmit for submission. Now, at the target php >> >> file, I >> >> want to first check if the user session is still valid..And only if it >> is >> >> valid should the php file go ahead and process the privacy settings >> user >> >> set >> >> in the form. If session is invalid, i redirect him back to the login >> >> page. >> >> >> >> Problem that happens is that since the submission is by AJAX, the >> display >> >> stays on the same page even though the session of the user has become >> >> invalid. the redirect doesnt work correctly. >> >> >> >> what wud be the best way to accomplish what I'm trying to do -- is it >> >> possible for me to check whether the session is valid within the >> >> javascript >> >> it self...and if not valid, redirect to login page ? >> >> >> >> thnx. >> >> >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Jquery-AJAXsubmit-and-cookie-tf3011518.html#a8363786 >> >> Sent from the JQuery mailing list archive at Nabble.com. >> >> >> >> >> >> ___ >> >> jQuery mailing list >> >> discuss@jquery.com >> >> http://jquery.com/discuss/ >> >> >> > >> > >> > -- >> > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ >> > ___ >> > jQuery mailing list >> > discuss@jquery.com >> > http://jquery.com/discuss/ >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Jquery-AJAXsubmit-and-cookie-tf3011518.html#a8364192 >> Sent from the JQuery mailing list archive at Nabble.com. >> >> >> ___ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> > > > -- > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Jquery-AJAXsubmit-and-cookie-tf3011518.html#a8364703 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Jquery AJAXsubmit and cookie
That makes sense conceptually, but how to translate that to jquery code ? How to verify the returning header from the php file. and then redirect within jquery ? thanks, Ⓙⓐⓚⓔ wrote: > > yup you have to redirect them! you can look at the header, and see > that the response has a custom header that tells you to give up and > get a new password. > > You can't use the normal redirect because that would just return the > login page to the ajax request... but then you could realize that it's > the login page and then send them to the real login page. > > Does that make sense? > the pure xml way would be to return a different xml format with the > error message in it instead of the normal data. > > On 1/14/07, unohoo <[EMAIL PROTECTED]> wrote: >> >> I use the AJAXsubmit and ajaxform at a couple of places in my php app. >> So, >> when a user clicks on 'change privacy', a form with radio buttons appears >> to >> change privacy settings of photo. >> >> the form relies on ajaxsubmit for submission. Now, at the target php >> file, I >> want to first check if the user session is still valid..And only if it is >> valid should the php file go ahead and process the privacy settings user >> set >> in the form. If session is invalid, i redirect him back to the login >> page. >> >> Problem that happens is that since the submission is by AJAX, the display >> stays on the same page even though the session of the user has become >> invalid. the redirect doesnt work correctly. >> >> what wud be the best way to accomplish what I'm trying to do -- is it >> possible for me to check whether the session is valid within the >> javascript >> it self...and if not valid, redirect to login page ? >> >> thnx. >> >> >> -- >> View this message in context: >> http://www.nabble.com/Jquery-AJAXsubmit-and-cookie-tf3011518.html#a8363786 >> Sent from the JQuery mailing list archive at Nabble.com. >> >> >> ___ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> > > > -- > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Jquery-AJAXsubmit-and-cookie-tf3011518.html#a8364192 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Jquery AJAXsubmit and cookie
I use the AJAXsubmit and ajaxform at a couple of places in my php app. So, when a user clicks on 'change privacy', a form with radio buttons appears to change privacy settings of photo. the form relies on ajaxsubmit for submission. Now, at the target php file, I want to first check if the user session is still valid..And only if it is valid should the php file go ahead and process the privacy settings user set in the form. If session is invalid, i redirect him back to the login page. Problem that happens is that since the submission is by AJAX, the display stays on the same page even though the session of the user has become invalid. the redirect doesnt work correctly. what wud be the best way to accomplish what I'm trying to do -- is it possible for me to check whether the session is valid within the javascript it self...and if not valid, redirect to login page ? thnx. -- View this message in context: http://www.nabble.com/Jquery-AJAXsubmit-and-cookie-tf3011518.html#a8363786 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] on click show form
So this means the function: $(function() { var jqForm = $('#your-form-id'); jqForm.hide(); $('a').click(function() { jqForm.show(); }); }); will be called when the document / page is ready. And then I also need to have a different function in there for the radio selector -- where would it go -- in the main $(function) ? Sorry abt the newbie questions. thanks, pranav. Klaus Hartl wrote: > > unohoo schrieb: >> Hi, >> >> I'm a convert from prototype and so apologies if this may come out as a >> dummy question. >> >> What I intend to do is following: >> >> I have a link ( element). On click, it displays a form which has 2 radio >> elements. By default, this form is not visible. only when the element >> is >> clicked, the form becomes visible. Then, on form visible, user can select >> any radio button and then form is processed. >> >> >> In prototype, I used the hide, visible ,block elements for accomplishing >> the above. By default, the form had a :hide associated to it. >> >> How do I accomplish the same in Jquery ? > > > $(function() { > > var jqForm = $('#your-form-id'); > jqForm.hide(); > $('a').click(function() { > jqForm.show(); > }); > > }); > > > -- Klaus > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/%3Ca%3E-on-click-show-form-tf2953602.html#a8261595 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] on click show form
Hi, I'm a convert from prototype and so apologies if this may come out as a dummy question. What I intend to do is following: I have a link ( element). On click, it displays a form which has 2 radio elements. By default, this form is not visible. only when the element is clicked, the form becomes visible. Then, on form visible, user can select any radio button and then form is processed. In prototype, I used the hide, visible ,block elements for accomplishing the above. By default, the form had a :hide associated to it. How do I accomplish the same in Jquery ? thanks, pranav. -- View this message in context: http://www.nabble.com/%3Ca%3E-on-click-show-form-tf2953602.html#a8261166 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/