9tontruck
Forum Replies Created
-
Forum: Plugins
In reply to: Returning JSON only pagenevermind. I got it ??
Forum: Plugins
In reply to: Returning JSON only pageThanks for the links. I learned a lot. I actually tweaked the sample code little bit so that php can make a http post call like this:
in function.php
class AjaxTools{ static function callAjax($url, $data) { $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); var_dump($result); } }
in main-page
[php] $data = array('action' => 'my_action', 'whatever' => '100'); AjaxTools::callAjax('https://localhost/wp/connect-update', $data); [/php]
in connect-update page
[php] add_action( 'wp_ajax_my_action', 'my_action_callback' ); function my_action_callback() { global $wpdb; // this is how you get access to the database $whatever = intval( $_POST['whatever'] ); $whatever += 10; echo $whatever; die(); // this is required to return a proper result } do_action('wp_ajax_my_action'); [/php]
But the returned data from the post call still contains all contents before the page which is header and $whatever. How can kill header print?
Forum: Plugins
In reply to: Returning JSON only pageThanks for reply. die() in my page kills side bar and footer but it does not kill header. I think die() should be called before header is drawn but writing “die()” in my page does not seem to be drawn earlier than the header..
Forum: Plugins
In reply to: [Synchi] I can't get it workUsing temporary <php sounds good to me. Thank you for your advice. And thank you for the great plugin
Forum: Plugins
In reply to: [Synchi] I can't get it workAs a lot of people are using the plugin called “Allow PHP” so it would be great if synchi also highlights code inside of [php][/php]
Can I manually add additional snippets?
Forum: Plugins
In reply to: [Synchi] I can't get it workThanks for reply. But Synchi doesn’t fully work in my wp.
After activating the plugin, when I try to make a new page.
In “text” tab, I wrote like this:[php]
$wdwd = ‘wd’;
if (2 == 2) {
echo ‘wdq’;
}function test() {
return 10;
}
[/php]The color of whole text is black. Only brackets ( (), {}, [] ) turns to green only if I click on one of a pair.
Forum: Plugins
In reply to: [Synchi] I can't get it worknever mind.
Forum: Themes and Templates
In reply to: jQuery in wordpress can't read xmlnevermind I figured it out
Forum: Themes and Templates
In reply to: I can't understand basic Ajax function..Is there a javascript forum in this web page?
Forum: Themes and Templates
In reply to: jquerythx!
Forum: Fixing WordPress
In reply to: how can I get all levels of title?thx!
Forum: Plugins
In reply to: why do comments keep awaiting moderation??no I havn’t changed anything on the admin page….