Re: [jQuery] Simplae JQuery/Ajax question - GET variables
Hi Nathan Thanks a lot for everything, managed to sort the years out OK not in the java but in the PHP page - I'm just an old fashioned PHP type of guy really. Thanks alot for everything parot wrote: > > Natahn, > > Very very nearly there - just ummm not sure where to put the Year code. > Other than that works perfectly in the calander I want which has a show / > hide function for a form with an ajax reply - I got tha bit working > perfectly, it was just using JQuery to prefect a page refresh on the month > change. That now happensd thanks, just - sorry to be a pain, where do I > put thae year function. Thanks a real lot. > > > > parot wrote: >> >> Nathan, what can I say, perfect. Thanks a lot. Think I understand it, Do >> years automatically increment / decrease with +newYear -newYear like >> months so you could have something like >> >> $("button#prevMonth").click(function() { >> loadMonth(--currentMonth),loadYear(--currentYear); }); >> >> >> Nathan Klatt-2 wrote: >>> >>> On Tue, Jan 19, 2010 at 1:45 PM, parot >>> wrote: I want to scroll back and forward through the months on a calendar without refreshing the page. I have the php calendar, but I don't want any page refresh which I can do with PHP and just send the GET to the page. so ideally what I need is 2 links back and forward with the month variable i.e. 1-12 (Jan - Dec) passed to JQury/Ajax. I have been looking at a number of scripts, but all to far complex (i.e. do more than I need) just I cant fathom out how to pass Back (Jan go to Dec) or Forward (Jan go to Feb) and so on. just need 1 month at a time, nothing fancy etc. >>> >>> How's about something like this? >>> >>> Previous month >>> >>> Next month >>> >>> >>> var currentMonth = 1; >>> function loadMonth(newMonth) { >>>$("#calendar").load("getCalendar.php?m="+newMonth); >>> } >>> $().ready(function() { >>>loadMonth(currentMonth); >>>$("button#prevMonth").click(function() { loadMonth(--currentMonth); >>> }); >>>$("button#nextMonth").click(function() { loadMonth(++currentMonth); >>> }); >>> }); >>> >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/Simplae-JQuery-Ajax-question---GET-variables-tp27229104s27240p27233076.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
Natahn, Very very nearly there - just ummm not sure where to put the Year code. Other than that works perfectly in the calander I want which has a show / hide function for a form with an ajax reply - I got tha bit working perfectly, it was just using JQuery to prefect a page refresh on the month change. That now happensd thanks, just - sorry to be a pain, where do I put thae year function. Thanks a real lot. parot wrote: > > Nathan, what can I say, perfect. Thanks a lot. Think I understand it, Do > years automatically increment / decrease with +newYear -newYear like > months so you could have something like > > $("button#prevMonth").click(function() { > loadMonth(--currentMonth),loadYear(--currentYear); }); > > > Nathan Klatt-2 wrote: >> >> On Tue, Jan 19, 2010 at 1:45 PM, parot >> wrote: >>> I want to scroll back and forward through the months on a calendar >>> without >>> refreshing the page. I have the php calendar, but I don't want any page >>> refresh which I can do with PHP and just send the GET to the page. so >>> ideally what I need is 2 links back and forward with the month variable >>> i.e. >>> 1-12 (Jan - Dec) passed to JQury/Ajax. I have been looking at a number >>> of >>> scripts, but all to far complex (i.e. do more than I need) just I cant >>> fathom out how to pass Back (Jan go to Dec) or Forward (Jan go to Feb) >>> and >>> so on. just need 1 month at a time, nothing fancy etc. >> >> How's about something like this? >> >> Previous month >> >> Next month >> >> >> var currentMonth = 1; >> function loadMonth(newMonth) { >>$("#calendar").load("getCalendar.php?m="+newMonth); >> } >> $().ready(function() { >>loadMonth(currentMonth); >>$("button#prevMonth").click(function() { loadMonth(--currentMonth); >> }); >>$("button#nextMonth").click(function() { loadMonth(++currentMonth); >> }); >> }); >> >> >> > > -- View this message in context: http://old.nabble.com/Simplae-JQuery-Ajax-question---GET-variables-tp27229104s27240p27232554.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
On Tue, Jan 19, 2010 at 2:29 PM, parot wrote: > so you could have something like > > $("button#prevMonth").click(function() { > loadMonth(--currentMonth),loadYear(--currentYear); }); Well, to handle year and month you'll want something like: var currentMonth = 1; var currentYear = 2010; function deltaMonth(delta) { currentMonth += delta; while (currentMonth < 1) { --currentYear; currentMonth += 12; } while (currentMonth > 12) { ++currentYear; currentMonth -= 12; } }
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
Nathan, what can I say, perfect. Thanks a lot. Think I understand it, Do years automatically increment / decrease with +newYear -newYear like months so you could have something like $("button#prevMonth").click(function() { loadMonth(--currentMonth),loadYear(--currentYear); }); Nathan Klatt-2 wrote: > > On Tue, Jan 19, 2010 at 1:45 PM, parot wrote: >> I want to scroll back and forward through the months on a calendar >> without >> refreshing the page. I have the php calendar, but I don't want any page >> refresh which I can do with PHP and just send the GET to the page. so >> ideally what I need is 2 links back and forward with the month variable >> i.e. >> 1-12 (Jan - Dec) passed to JQury/Ajax. I have been looking at a number of >> scripts, but all to far complex (i.e. do more than I need) just I cant >> fathom out how to pass Back (Jan go to Dec) or Forward (Jan go to Feb) >> and >> so on. just need 1 month at a time, nothing fancy etc. > > How's about something like this? > > Previous month > > Next month > > > var currentMonth = 1; > function loadMonth(newMonth) { >$("#calendar").load("getCalendar.php?m="+newMonth); > } > $().ready(function() { >loadMonth(currentMonth); >$("button#prevMonth").click(function() { loadMonth(--currentMonth); }); >$("button#nextMonth").click(function() { loadMonth(++currentMonth); }); > }); > > > -- View this message in context: http://old.nabble.com/Simplae-JQuery-Ajax-question---GET-variables-tp27229104s27240p27232199.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
On Tue, Jan 19, 2010 at 1:45 PM, parot wrote: > I want to scroll back and forward through the months on a calendar without > refreshing the page. I have the php calendar, but I don't want any page > refresh which I can do with PHP and just send the GET to the page. so > ideally what I need is 2 links back and forward with the month variable i.e. > 1-12 (Jan - Dec) passed to JQury/Ajax. I have been looking at a number of > scripts, but all to far complex (i.e. do more than I need) just I cant > fathom out how to pass Back (Jan go to Dec) or Forward (Jan go to Feb) and > so on. just need 1 month at a time, nothing fancy etc. How's about something like this? Previous month Next month var currentMonth = 1; function loadMonth(newMonth) { $("#calendar").load("getCalendar.php?m="+newMonth); } $().ready(function() { loadMonth(currentMonth); $("button#prevMonth").click(function() { loadMonth(--currentMonth); }); $("button#nextMonth").click(function() { loadMonth(++currentMonth); }); });
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
Hi Nathan http://www.websequencediagrams.com - now I'm "really confused" I think I understand it but but let me explain I want to scroll back and forward through the months on a calendar without refreshing the page. I have the php calendar, but I don't want any page refresh which I can do with PHP and just send the GET to the page. so ideally what I need is 2 links back and forward with the month variable i.e. 1-12 (Jan - Dec) passed to JQury/Ajax. I have been looking at a number of scripts, but all to far complex (i.e. do more than I need) just I cant fathom out how to pass Back (Jan go to Dec) or Forward (Jan go to Feb) and so on. just need 1 month at a time, nothing fancy etc. Nathan Klatt-2 wrote: > > On Tue, Jan 19, 2010 at 11:32 AM, parot > wrote: >> Very near, but it is more basic than that - how do I get the variable >> ?trythis="changable value" into var trythis=""; > > Maybe a sequence diagram would be helpful. Here's what I hear you asking: > > http://www.websequencediagrams.com/?lz=bm90ZSBsZWZ0IG9mIHdlYnBhZ2U6IG1lIGZpcnN0IQpKYXZhc2NyaXB0LT50cnlpdC5waHA6IHRyeXRoaXMgPSA1NwoAPwVyaWdoAEAFABsLU2ltcGxlIGVjaG8gb2YgdmFyaWFibGUANggKAEgJLS0-AF8KOiA1NwBrDQCBDgkACQ8AexUic29tZXRoaW5nIGVsc2UiAExSAFERAIEXFQB3EQ&s=default > > Could you modify that to better explain what you mean, maybe? > > Nathan > > -- View this message in context: http://old.nabble.com/Simplae-JQuery-Ajax-question---GET-variables-tp27229104s27240p27231466.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
On Tue, Jan 19, 2010 at 11:32 AM, parot wrote: > Very near, but it is more basic than that - how do I get the variable > ?trythis="changable value" into var trythis=""; Maybe a sequence diagram would be helpful. Here's what I hear you asking: http://www.websequencediagrams.com/?lz=bm90ZSBsZWZ0IG9mIHdlYnBhZ2U6IG1lIGZpcnN0IQpKYXZhc2NyaXB0LT50cnlpdC5waHA6IHRyeXRoaXMgPSA1NwoAPwVyaWdoAEAFABsLU2ltcGxlIGVjaG8gb2YgdmFyaWFibGUANggKAEgJLS0-AF8KOiA1NwBrDQCBDgkACQ8AexUic29tZXRoaW5nIGVsc2UiAExSAFERAIEXFQB3EQ&s=default Could you modify that to better explain what you mean, maybe? Nathan
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
Thnks Nathan, Very near, but it is more basic than that - how do I get the variable ?trythis="changable value" into var trythis=""; Sounds silly and quiet simpel, but can I get a "plain" english answer - no Thanks for your reply Nathan Klatt-2 wrote: > > On Tue, Jan 19, 2010 at 11:06 AM, parot > wrote: >> What I cannot do and I do not seem to get a sensible, easy to follow and >> understandable answer from knowledgeable JQuery people is find out how to >> pass the valiable trythis to the page tryit.php and then return the >> result, >> in this case a simple php echo. > > I must misunderstand you... > > var trythis = 57; > $.get("tryit.php", { trythis: trythis }, function(data) { > $("#resultsGoHere").html(data); }); > > Nathan > > -- View this message in context: http://old.nabble.com/Simplae-JQuery-Ajax-question---GET-variables-tp27229104s27240p27229508.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Simplae JQuery/Ajax question - GET variables
On Tue, Jan 19, 2010 at 11:06 AM, parot wrote: > What I cannot do and I do not seem to get a sensible, easy to follow and > understandable answer from knowledgeable JQuery people is find out how to > pass the valiable trythis to the page tryit.php and then return the result, > in this case a simple php echo. I must misunderstand you... var trythis = 57; $.get("tryit.php", { trythis: trythis }, function(data) { $("#resultsGoHere").html(data); }); Nathan
[jQuery] Simplae JQuery/Ajax question - GET variables
I am very (very) used to PHP but just trying to grips with JQuery/Ajax and this is a very simple problem that I cannot find an easy - & understandable answer to especially one that works - strange I know. My experience is that all answers to this question - on another site - are too complex and totally miss the point. Take a standard HTML link Get this page now add a get variable ?trythis=a-changing-value Get this page I want to pass ?trythis=a-changing-value via JQuery/Ajax to another page, perform a query based on the actual value of 'trythis' ( but for this example I am only using echo $_GET[] as I can work out the PHP query with ease ONCE i can get the trythis variable to the page) and then display those results without a page refresh on the original page. e.g. Page one in the head: $(document).ready(function() { $("#idoflink").click(function() { somewhere I need to declare the variable trythis and use it in JQuery/Ajax- WHERE and HOW and no a fixed hard coded reply will not help, the variable trythis will have changing values $("#display_results_here").load("tryit.php"); }); }); In the body ?trythis=a-changing-value Get this page Then on the page tryit.php a simple echo $_GET['trythis']; What I cannot do and I do not seem to get a sensible, easy to follow and understandable answer from knowledgeable JQuery people is find out how to pass the valiable trythis to the page tryit.php and then return the result, in this case a simple php echo. -- View this message in context: http://old.nabble.com/Simplae-JQuery-Ajax-question---GET-variables-tp27229104s27240p27229104.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.