[FX.php List] [OFF] Bootstrap question

Bob Patin bob at patin.com
Thu Dec 31 14:09:31 MST 2015


OK, sorry… didn’t answer you…

The CANCEL button gets loaded on every page that I load into the DOM; all of them call this same code.

So the code below is what gets called when you click the CANCEL button anytime it appears:

	 // CANCEL
	$('.main').delegate('.cancel', 'click', function(){
		var page = '<?php echo $_SESSION['homepage']; ?>';
		//window.location = page;
		$('.main').load('date.php'),function (){
			$('.title').html('testing');
			$('#datepicker').datepicker();
		}
		alert('test');
		return false;
	});

I could just use the window.location command to reload the app, but that’s slow and clunky; I was hoping to do it this way, which is cleaner and faster.

You can see it here:

http://www.titanicbranson.com/new/index.php

Note that you won’t see an error in Firebug when you click the CANCEL button…


> On Dec 31, 2015, at 3:04 PM, Steve Winter <steve at bluecrocodile.co.nz> wrote:
> 
> And that's only going to get called when the cancel button gets clicked...
> 
> You've got them the wrong way round... Try this:
> 
>> $('.main').load(‘date.php'),function (){
>> 		console.info <http://console.info/>('hello Bob');
>                  
>> 	
>> 		}).on('click', '.cancel', function(){
> // do whatever
> });
> 
> But you never answered the question - when does the button with class cancel get loaded into the DOM..? Is it always present at page load, or does it come back in the return of date.php....?
> 
> 
> Steve Winter
> steve at bluecrocodile.co.nz <mailto:steve at bluecrocodile.co.nz>
> +44 777 852 4776
> 
> On 31 Dec 2015, at 21:39, Bob Patin <bob at patin.com <mailto:bob at patin.com>> wrote:
> 
>> So…
>> 
>> I did this:
>> 
>> 	$('.main').delegate('.cancel', 'click', function(){
>> 		$('.main').load(‘date.php'),function (){
>> 			$('title').html('testing');
>> 		}
>> 		return false;
>> 	});
>> 
>> It should put “testing” into a DIV on my page, but not only does that happen, but nothing else I put in there works either…
>> 
>> So odd. My DATE page is really simple—it calls the date picker widget and then puts up a pulldown menu and a couple of buttons…
>> 
>> Here’s a thought: one of the 2 buttons calls the CANCEL function above; that can’t be causing a loop, could it?
>> 
>> Should “return false” be inside the function as opposed to outside it?
>> 
>> B
>> 
>> 
>>> On Dec 31, 2015, at 2:27 PM, Steve Winter <steve at bluecrocodile.co.nz <mailto:steve at bluecrocodile.co.nz>> wrote:
>>> 
>>> Hi Bob
>>> 
>>> Add the callback to the load:
>>> 
>>> .load('date.php', function(){
>>>       // your binding code goes here
>>> });
>>> 
>>> Best I can do from the couch at 2130 on NYE ;-)
>>> 
>>> Cheers
>>> Steve
>>> 
>>> Steve Winter
>>> steve at bluecrocodile.co.nz <mailto:steve at bluecrocodile.co.nz>
>>> +44 777 852 4776
>>> 
>>> On 31 Dec 2015, at 20:44, Bob Patin <bob at patin.com <mailto:bob at patin.com>> wrote:
>>> 
>>>> Hey Steve,
>>>> 
>>>> That’s what I was thinking it was… question: if I have a load() call, how do I make it so that the next calls don’t happen until the load() finishes?
>>>> 
>>>> Can you show me a fast example of that? That’s exactly what I was thinking, but didn’t know how to write it…
>>>> 
>>>> Thanks,
>>>> 
>>>> B
>>>> 
>>>> 
>>>>> On Dec 31, 2015, at 1:41 PM, Steve Winter <steve at bluecrocodile.co.nz <mailto:steve at bluecrocodile.co.nz>> wrote:
>>>>> 
>>>>> When does the cancel button end up in the DOM...? Is it as the result of the first load of date.php...?
>>>>> 
>>>>> If so, try binding to the cancel as a callback on that load - chances are that at the point at which the bind is being called the second Ajax request hasn't completed so it fails to bind correctly.
>>>> 
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org <mailto:FX.php_List at mail.iviking.org>
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list <http://www.iviking.org/mailman/listinfo/fx.php_list>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org <mailto:FX.php_List at mail.iviking.org>
>>> http://www.iviking.org/mailman/listinfo/fx.php_list <http://www.iviking.org/mailman/listinfo/fx.php_list>
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org <mailto:FX.php_List at mail.iviking.org>
>> http://www.iviking.org/mailman/listinfo/fx.php_list <http://www.iviking.org/mailman/listinfo/fx.php_list>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20151231/75c50599/attachment-0001.html


More information about the FX.php_List mailing list