Posted: February 9th, 2010 | Author: admin | Filed under: Javascript, PHP | No Comments »
If you are developing an CakePHP application where ajax is mostly used. It is advisable that you set the following session configurations inside your core.php.
Configure::write('Session.timeout', '86400'); // expires in 30 days
Configure::write('Security.level', 'medium');
If your application calls more than one ajax request at the same time, it is recommended that you set your ajax requests to synchronous to prevent session regeneration id errors.
Posted: February 9th, 2010 | Author: admin | Filed under: Javascript | Tags: jQuery | No Comments »
This tutorial illustrates how to check if a plugin exists or if plugin has been already loaded usingĀ jQuery. This is particularly useful if you are writing your jQuery code that depends on that plugin.
if(jQuery().plugin_name) {
// plugin exists
} else {
// plugin not loaded
}
Posted: June 8th, 2009 | Author: admin | Filed under: Javascript | Tags: jQuery, radio buttons | 2 Comments »
Here’s a tutorial on how to get the value of a checked or selected radio button out of a group of radio buttons:
...
<input type="radio" name="sample" value="1" />
<input type="radio" name="sample" value="2" checked="checked" />
<input type="radio" name="sample" value="3" />
...
//javascript code
<script type="text/javascript">
<!--
// displays the selected radio button in an alert box
alert($('input[name=sample]:checked').val())
-->
</script>
Posted: May 20th, 2009 | Author: admin | Filed under: Javascript | Tags: ajax load, jQuery BlockUI, page block | No Comments »
This tutorial shows you how to block/disable your web page whenever an application is processing an ajax request. First, you would have to download the latest jQuery library and the jQuery BlockUI plugin. Usage is very simple; Here’s a sample to block user activity for the page whenever an ajax request is called:
<script type="text/javascript" src="jquery-latest.js" language="javascript"></script>
<script type="text/javascript" src="jquery.blockui.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
<!--
$(document).ready( function () {
<!-- Page block animation during ajax requests -->
$().ajaxStart($.blockUI).ajaxStop($.unblockUI);
$('#form_button').click( function () {
$.ajax({
<!-- Ajax actions here -->
....
});
});
});
-->
</script>
For more options on using jQuery BlockUI plugin go here
Posted: May 20th, 2009 | Author: admin | Filed under: Javascript | Tags: ajax, preload images | No Comments »
If you’re looking for cool ajax preloading animated images, go to http://www.ajaxload.info. You get to customize your preload images and download them for free. Try it out!