“Uncaught SyntaxError: Unexpected token
“Uncaught SyntaxError: Unexpected token <" in load-scripts.php [closed]
“Uncaught SyntaxError: Unexpected token <" in load-scripts.php [closed]
you are doing some wrong things, 1st $_POST[‘data’]; not contain any post data use json array’s keys to get post data like. $data_key1 = $_POST[‘key1’]; $data_key2 = $_POST[‘key2’]; // and so on … replace key1 key2 etc with json data keys which your ajax request sent.
If all you’re wanting to do is save extra post data you should not need jquery or custom ajax. WordPress has a built in action you can use to achieve this same thing. add_action( ‘save_post’, ‘save_more_post_meta’ ); function save_more_post_meta( $post_id ) { //save stuff here } If you need help with saving specifics i’ll need … Read more
CPU usage: AJAX and Heartbeat API on admin pages
Making a follow button, Ajax not talking to php
Cannot update my options using wp_ajax
Setting TinyMCE Content in wp_editor
WP REST API route request explain
Try to add ob_start(); and ob_clean(); to showads function, that might be better to not break the output. function showads(){ ob_start(); echo do_shortcode(‘[myshortcode]’); $result = ob_clean(); return $result; exit(); }
I believe the problem is you are not calling do_shortcode() in the output buffer. You don’t need to be running the loop within the output buffer since I can assume get_content_template() simply returns HTML with embedded shortcodes. Save that to a string variable, then run that through the do_shortcode() and save the echoed output to … Read more