Cjax Framework


Project development is new to github. Give us a star.

Access Your JS Functions

In Cjax, you can control most HTML objects/elements with the $ajax object. You can also control JavaScript Objects and functions of other scrips. Cjax allows to access your existing JavasScript very easily and elegantly.

If you have written some custom JavaScript functions or you are using a third party script, that you need to run or interact with, Cjax lets you access them right from the backend.

Examples

You have a custom JavaScript function, and you would like to execute it. Here is how.

Here is how you access your function. Cjax makes it seemsless.

PHP
<?php 


$ajax
->myCustomFunction();

?>
JavaScript
//your custom function
<script>

	function myCustomFunction()
	{
		//your javascript code..
	}

</script>

You can also pass parameters to your functions if you need to. Cjax will allow you to pass arrays, and strings. You will receive them in your JavaScript as a Json object or a string.

PHP
<?php 


$ajax
->myCustomFunction(array('test','test','test'), 'test');

?>
JavaScript
//your custom function
<script>

	function myCustomFunction(data, data2)
	{
		console.log(data, data2);

		//the parameters that you passed in php, have become available in your JavaScript function.
	}

</script>


Previous Topic:  Previous Class    ·   Top of Page   ·   Demos Home   ·  

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax