Ajax in plugin settings page returns 400 Bad Request
damn it! I just found it… my JS says action: ‘bblm_result’ but my PHP function is looking for wp_ajax_bblm_results … there go my 3hours of searching
damn it! I just found it… my JS says action: ‘bblm_result’ but my PHP function is looking for wp_ajax_bblm_results … there go my 3hours of searching
There is no get_pages() method in the WP_Query class (for WordPress version 4.9.4). So in the data_fetch() function, replace the following: if( $the_query->get_pages() ) : while( $the_query->get_pages() ): $the_query->get_pages(); ?> ..with this: if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> And in the fetch() JS function, set the type to POST, like so: function … Read more
You can get your code to work by tweaking it a little bit. First, you need to create a form that includes the categories. Then, submit the form the the same page to apply it to the query. <div class=”latest_video”> <!– We add a form that submits the request the the same page –> <form … Read more
So basicly you want an ajax method that checks for post changes. Here’s a great article on WP ajax for front & back-end. In short you want to do the following: Load the Ajax JS script on the pages you want to show the notification popup. Create wp ajax server-side handling, with hook wp_ajax_{your_custom_action}. OR … Read more
You have two problems in PHP you need change this is bad: wp_localize_script( ‘customjquery’, ‘ajaxurl’, admin_url( ‘admin- ajax.php’ ) ); change to: wp_localize_script( ‘customjquery’, ‘my_custom_vars’, [‘ajax_url’ => admin_url(‘admin-ajax.php’)] ); and your javascript need this changes is bad: $.ajax({ type: ‘POST’, // use $_POST method to submit data dataType: “html”, url: ajaxurl, change to: $.ajax({ type: … Read more
Try removing children inside #qdModalWindow before attempting load new content inside it. $(‘#qdModalWindow’).children().remove();
Please try following code it will works for you. Please add this in your functions.php for getting current page URL /*Get Current Url */ function currentUrl( $trim_query_string = false ) { $pageURL = (isset( $_SERVER[‘HTTPS’] ) && $_SERVER[‘HTTPS’] == ‘on’) ? “https://” : “http://”; $pageURL .= $_SERVER[“SERVER_NAME”] . $_SERVER[“REQUEST_URI”]; if( ! $trim_query_string ) { return … Read more
$wpdb->get_results() only returns arrays( associative or numeric) or an object. It does not return a string value. If you want a string value, you need to use $wpdb->get_var() instead
If you use nonces properly, it won’t be possible to make the site to process fake request… So this part should be secure, but… There is still one security flaw in your approach… What if I can make you to run my JS script in your browser, while you’re logged in as admin? It is … Read more
There are many reasons this error can occur. Those two were the most frequent for me: Session-Cookie Open the Javascript Console by pressing F12 and click on the tab “Console”. If you see some error message that goes something like cookie_nonce it’s a session cookie problem. The problem solves by just completely logging out and … Read more