Skip to content

Vodzo/php_jquery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php_jquery

write jquery in php

note: the JS part doesn't check if a function exists.

#Usage In PHP:

include('jQuery.php');
$json['jquery'] = array();
$j = jQuery('#test')->html(
                jQuery('#test2')->html('overwritten')->html()
            )->removeClass('init_class')->addClass('new_class');
$json['jquery'][] = $j->compile();

In html/js:

<script>
var data = <?=json_encode($json)?>;
var jquery = data.jquery;
pQuery.run(jquery);
</script>

Results: before

<div id="test" class="init_class">this will be overwritten</div>
<div id="test2">div 2</div>

after

<div id="test" class="new_class">overwritten</div>
<div id="test2">overwritten</div>

About

write jquery in php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published