{"id":3187,"date":"2008-06-07T13:53:30","date_gmt":"2008-06-07T13:53:30","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-xajax\/"},"modified":"2008-06-12T13:23:21","modified_gmt":"2008-06-12T13:23:21","slug":"wp-xajax","status":"closed","type":"plugin","link":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-xajax\/","author":144759,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"","stable_tag":"1.0","tested":"2.5","requires":"2.2","requires_php":"","requires_plugins":"","header_name":"WP-Xajax","header_author":"Leo Germani","header_description":"","assets_banners_color":"","last_updated":"2008-06-12 13:23:21","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/pirex.com.br\/wordpress-plugins","header_plugin_uri":"http:\/\/pirex.com.br\/wordpress-plugins\/wp-xajax","header_author_uri":"http:\/\/pirex.com.br\/wordpress-plugins","rating":0,"author_block_rating":0,"active_installs":10,"downloads":3394,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[71769,734,3002,2391,1249],"plugin_category":[43],"plugin_contributors":[80208],"plugin_business_model":[],"class_list":["post-3187","plugin","type-plugin","status-closed","hentry","plugin_tags-axax","plugin_tags-development","plugin_tags-framework","plugin_tags-plugins","plugin_tags-themes","plugin_category-customization","plugin_contributors-leogermani","plugin_committers-leogermani"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wp-xajax.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Provides an easy way for plugin\/theme developers to use Xajax framework to write ajax applications.<\/p>\n\n<h3>Usage<\/h3>\n\n<p>For an overview on how to use XAjax and complete documentation, visit its wiki at http:\/\/xajaxproject.org\/wiki\/.<\/p>\n\n<p>Here you find a very pratical tutorial on how to write a wordpress plugin using xajax. This tutorial is based on the great \"Learn xaja in 10 minutes\", wich you find here: http:\/\/xajaxproject.org\/wiki\/Tutorials:Learn_xajax_in_10_Minutes<\/p>\n\n<p>How to write a plugin using wp-xajax.<\/p>\n\n<ol>\n<li>Install wp-xajax<\/li>\n<\/ol>\n\n<p>Obviusly you have to install it at first. Nothing will happen when you activate it, thats the way it is.<\/p>\n\n<ol>\n<li>Write your php function<\/li>\n<\/ol>\n\n<p>Now, inside your plugin, you will write you php function that will be dinamically called through javascript.<\/p>\n\n<p>This function can do anything you like: access the database, send emails, call other functions.. whatever.<\/p>\n\n<p>The only thing this function can not do is to produce any output to the screen. It cannot have any \"echo\" calls.<\/p>\n\n<p>In the next step we will see how to send output to the screen. So, lets say we want a function to send an email:<\/p>\n\n<p>function myplugin_sendEmail(){<\/p>\n\n<pre><code>$friends = 'bob@example.org,susie@example.org';\nmail($friends, \"blog updated\", \n  'I just put something on my blog: http:\/\/blog.example.com');\n<\/code><\/pre>\n\n<p>}<\/p>\n\n<p>This function does not receive any argumnent, but you can have a function that receives as many argumnents as you like.<\/p>\n\n<ol>\n<li>Add some response to your function<\/li>\n<\/ol>\n\n<p>Lets say you have a div next to your button with the id \"response_div\". Then you can add this to you function:<\/p>\n\n<p>function myplugin_sendEmail(){<\/p>\n\n<pre><code>$friends = 'bob@example.org,susie@example.org';\nmail($friends, \"blog updated\", \n  'I just put something on my blog: http:\/\/blog.example.com');\n\n$objResponse = new xajaxResponse();\n$objResponse-&gt;addAssign(\"response_div\",\"innerHTML\",\"Email Sent!\");\nreturn $objResponse;\n<\/code><\/pre>\n\n<p>}<\/p>\n\n<p>You will allways interact with the page objects using their ids. There are many ways in wich you can interact, have a look at\nthe full doc here: http:\/\/xajaxproject.org\/wiki\/Documentation:xajaxResponse.inc.php<\/p>\n\n<ol>\n<li>Call your function<\/li>\n<\/ol>\n\n<p>A javascript function will be created. It will be called xajax_YourFunctionName.<\/p>\n\n<p>So you may have a button, and add to this button the event Handler:<\/p>\n\n<p>input type=\"button\" onclick=\"xajax_myplugin_sendEmail()\";<\/p>\n\n<p>if you have any arguments to pass, do it now as if it was a regular javascript function.<\/p>\n\n<ol>\n<li>Register your function<\/li>\n<\/ol>\n\n<p>Create a function that will register your xajax_function as follow:<\/p>\n\n<p>function myplugin_xajax(){\ngobal $xajax;\n$xajax-&gt;registerFunction(\"myplugin_sendEmail\");\n}<\/p>\n\n<p>And then add an action to call it:<\/p>\n\n<p>add_action('init','myplugin_xajax');<\/p>\n\n<ol>\n<li>Enjoy!<\/li>\n<\/ol>\n\n<!--section=installation-->\n<ol>\n<li>on Regular Wordpress<\/li>\n<\/ol>\n\n<p>. Copy the files to you root plugins folder, so you have a tree like:<\/p>\n\n<p>...\/wp-content\/plugins\/wp-xajax.php\n...\/wp-content\/plugins\/wp-xajax\/xajax.inc.php\n...\/wp-content\/plugins\/wp-xajax\/...all the other files<\/p>\n\n<p>. Activate the plugin<\/p>\n\n<ol>\n<li>on Wordpress MU<\/li>\n<\/ol>\n\n<p>. Copy the files to you root plugins folder, so you have a tree like:<\/p>\n\n<p>...\/wp-content\/mu-plugins\/wp-xajax.php\n...\/wp-content\/mu-plugins\/wp-xajax\/xajax.inc.php\n...\/wp-content\/mu-plugins\/wp-xajax\/...all the other files<\/p>\n\n<!--section=changelog-->\n<p>1.0 (06\/06\/2008)\n. Released<\/p>","raw_excerpt":"Provides an easy way for plugin\/theme developers to use Xajax framework to write ajax applications.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/3187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=3187"}],"author":[{"embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/leogermani"}],"wp:attachment":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=3187"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=3187"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=3187"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=3187"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=3187"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=3187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}