Skip to main content

Questions tagged [ajax]

Ajax - The core of WordPress uses Ajax only in the administration screens. For instance, Ajax is used for instant updates when you are doing comment moderation, and when you are adding and deleting items from lists such as categories, blogroll, and posts; Ajax is also the technology behind the auto-save functionality on post and page editing screens. Several themes and plugins also use Ajax; for instance, some post rating plugins.

8 votes
2 answers
15k views

AJAX search on post pages by custom post type

I'm having an issue creating an ajax search on my single post pages. I need to limit the search results to the custom post types "fod_videos" and "post" and category 12. My issue is the search is ...
Pollux Khafra's user avatar
8 votes
1 answer
2k views

Nonces can be reused multiple times? Bug / Security issue?

I've read that nonces are meant to be for one time use only, and after an ajax request, you should issue a new nonce so with the next ajax request, a new nonce would be sent to the server. However, I ...
Click Upvote's user avatar
8 votes
5 answers
6k views

is_admin() returns true when using admin-ajax.php from front end script

Had a situation today where I was using admin-ajax.php from a front end script. As I understand it this the wp way to make ajax calls (registering my function with the wp_ajax_nopriv_myfunction hook) ...
Thomas's user avatar
  • 81
8 votes
3 answers
4k views

How to save dismissable notice state in WP 4.2?

In WordPress 4.2 the is-dismissible class was introduced to allow notices to be dismissed. This code is working to add the notice. function prefix_deprecated_hook_admin_notice() { if ( ...
grappler's user avatar
  • 845
8 votes
1 answer
41k views

failed to load wp-admin/admin-ajax.php

I'm getting this strange issue. Everything was working fine last day. Now suddenly none of my ajax requests work. The problem is (i found that in firebug console): failed to load resource : ....../...
webdwall's user avatar
  • 321
8 votes
2 answers
2k views

Using Backbone with the WordPress AJAX API

I'm attempting to build out a simple TODO plugin using Backbone and have run into an issue with the AJAX API. In order to get the correct AJAX call back you have to pass in the "action" parameter ...
hereswhatidid's user avatar
7 votes
3 answers
29k views

Using Ajax with a Class file

At the moment I have an ajax that works (I get a success [200] response), but having an issue with the action hooks on the response. The JSON object is not coming back, instead I'm getting a 0. I ...
Xtremefaith's user avatar
7 votes
1 answer
3k views

Ajax in a settings page (update_option is undefined)

I'm making a request to my plugin's php file via ajax and it's supposed to save some data with update_option(), but php throws an error: Call to undefined function update_option() I'm guessing that ...
Nikolay Dyankov's user avatar
7 votes
3 answers
4k views

WordPress Ajax Data Security

I am aware of nonces to check for intentions but can't make any sense if I can use them to restrict for database reads somehow? I mean, I am fetching records from the database using AJAX but I don't ...
Ashfame's user avatar
  • 3,715
7 votes
1 answer
31k views

How can I run AJAX on a button click event?

Update: I managed to get the AJAX working, but not in the click event. I updated the question to match this. I'm trying some code I found on the page: 'AJAX in Plugins'. However I can't get it to ...
joon's user avatar
  • 199
7 votes
1 answer
19k views

Updating custom post meta with ajax

This AJAX function gets called on a click: $.ajax({ url: 'site/ajax.php', data: {id: $('section#single article input:last-of-type').attr('value'), cote: 'like'} })....
user avatar
7 votes
2 answers
47k views

add_action('wp_ajax_[action name]', myfunction) problem

I'm trying to integrate ajax in wordpress using the wp codex guidelines. In the PHP I added: wp_enqueue_script ( 'my_ajax', ADMIN_URL . 'js/ajax.js','jquery','1.0.0' ); wp_localize_script( 'my_ajax', ...
user1567's user avatar
  • 497
7 votes
1 answer
15k views

Stop admin-ajax?

Is it possible to simply disable/stop admin-ajax.php from running? Have searched WordPress Doc. Have searched Google. Have searched this forum. Found no answer. Have also tried this, but it doesn't ...
Peter Westerlund's user avatar
7 votes
3 answers
22k views

Displaying PHP Errors from admin-ajax.php

We've got some custom endpoints set up that do various things, which we access via /wp/wp-admin/admin-ajax.php?action=some_action However whenever there is an error as we're developing, such as ...
owenmelbz's user avatar
  • 171
7 votes
2 answers
11k views

Enable Submit Comment Without Page Reload (Using Ajax)?

When user writes a comment and hits the submit button, WordPress reloads the page, before the comment is shown to the user. Is there an Ajax-based solution that allows users to submit questions ...
its_me's user avatar
  • 4,502

15 30 50 per page