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.

Filter by
Sorted by
Tagged with
1
vote
0answers
6 views

Get image URL after image created from canvas and sent to WP uploads with AJAX

Hello there people my people, sorry I'm a PHP newbie and could use some help! I'm making an image from a canvas element which is being converted from BASE64 into a .PNG and sent to my WP uploads ...
0
votes
2answers
41 views

Data not insert and update through ajax and jQuery in admin page?

I made custom plugin and done crud operation, display all data in admin page, used ajax and jquery. Data successfully deleted but not inserted or updated. Data successfully pass through ajax but not ...
0
votes
1answer
9 views

Adding ELSE argument to AJAX Live Search for “No results found”

Having finally being able to make an AJAX driven live search functional, I need help understanding how to add an else argument function so that when there are no posts matching the search query, the ...
0
votes
0answers
14 views

Why does check_ajax_referer give a 403 error on https websites?

When I write an ajax funtion on a site without SSL, check_ajax_referer works as intended. But it fails with a 403 forbidden error on a https site. I've tried a lot of times, but I just don't know why ...
0
votes
1answer
23 views

Force redirect not logged in user to (wp-login.php or wp-admin) for specific page

I am currently using a Wordpress plugin (Pagerestrict plugin which references URLS based on Page ID/Slugs)to restrict certain pages to logged in users only. This plugin works fine with standard ...
0
votes
0answers
26 views

Ajax login fails: script sets cookies, but is_user_logged_in() returns false

Summary Ajax request to a back-end plugin PHP script successfully logs in the user and sets login cookies in the browser. However, the page making the call fails to recognize those cookies, and ...
1
vote
1answer
34 views

Create a new post using rest api and save featured image using an external image url

I am trying to create a post using the rest API. Which I am able to do with a fetch request as below. OurPostData contains the title, content and URL of a featured image which is an external url ...
0
votes
1answer
23 views

How to make a fetch() POST request to wordpress rest api?

I am trying to make a POST request to rest api. But I am getting 401 Unauthorised error. Also can someone help with handling nonce in it? #OurPostData : Contains the title. fetch('https://mywebsite....
-3
votes
0answers
14 views

I want to change the loaded page by AJAX when clicking on a menu [closed]

Recently I want that we want every page from our menu to change by WordPress AJAX system and not reload the browser, like Facebook does. If you don't understand this then it's easy: if I click any ...
0
votes
0answers
9 views

Add a functionality to quickly filter custom posts in Admin Area

I am creating a website for a doggie rescue, basically configuring the backend so they can manage dogs, volunteers, etc. The legacy system had a feature where the user could start typing into an input ...
0
votes
0answers
20 views

Get post id of post created with POST request on rest api [closed]

I am creating a new post using the front end form by sending a post request to rest api. Is there a way to have a callback function something to that I could get the post id of the post created? So ...
0
votes
0answers
16 views

How to run [products] shortcode in AJAX with loading the product label

This question is related to this plugin https://woocommerce.com/products/woocommerce-advanced-product-labels/ that is located at woocommerce.com. My question is, I'm trying to display the woocommerce ...
0
votes
1answer
23 views

Can I make get_users() query global?

I have the following query $args = [ 'meta_key' => 'mycred_default', 'orderby' => [ 'meta_value_num' => 'DESC' ], 'order' => 'desc', 'number' => 10 ];...
1
vote
1answer
23 views

prevent default not stopping page refresh. Passing form information to and from php with ajax in a wordpress site

I have seen a number of methods dating back to about 2011 in order to take a form and have its data posted via ajax.jquery. I have tried a couple and am just getting the page to reload despite using ...
0
votes
1answer
14 views

How to Object.freeze wp_localize_script

I have a localize script that have sensitive information that i dont want other users change it from the console. is it possible to Object freeze my localized script? wp_localize_script('test-...
1
vote
1answer
22 views

SSO autologin Wordpress + Ajax

That one keeps me awake at night. The problem is that the user is properly logging in, but AFTER page refresh and should be immediately logged in without page reload. Need a fresh eyes to look at it. ...
1
vote
2answers
31 views

how update data through ajax and jquery

I try to update data through ajax, but it not worked. What I did wrong? Here is jquery ajax code php code in functions.php function update_records(){ global $wpdb; echo $id = $_POST['update_record'...
0
votes
1answer
15 views

Populate Product Regular Price with a calculated ACF Field Value

Could someone kindly assist me with how to auto populate a value of Regular Price Field in Simple Product with a value that I calculate using ACF. Here is a scenario. All Products in our store are ...
0
votes
2answers
22 views

AJAX form post returns 0

I am working on a simple plugin that shows an HTML form where the user can input a keyword which is used to query an external API. I currently have the form and the related jQuery set up, but when ...
0
votes
2answers
16 views

Ajax calls from the theme directory

I've got a custom theme I build using an underscores starter theme. Inside one of my template files (page-talent.php) I've got this jQuery ajax function: $.ajax({ type: 'POST', ...
0
votes
0answers
16 views

Do not query similar content using custom meta on Ajax WordPress

I got the relelated content from costum meta using it and it works fine but when I use Ajax it query "relation" applies it incorrectly add_action( 'wp_enqueue_scripts', '...
0
votes
0answers
21 views

How can i find wrong word in search box and replace with correct word

I have a search form and Many site users search for the wrong words, I want to replace these wrong words with the right ones so that users can get results faster. I have been searching for this for ...
0
votes
2answers
33 views

Why Ajax Doesn't Work?

I have a separate page at the root of WordPress, for processing certain data, with the "wp-load.php" file connected to it. <?php require_once( dirname(__FILE__) . '/wp-load.php' ); ...
0
votes
0answers
30 views

call_user_func_array() expects parameter 1 to be a valid callback, class 'WC_Rapyd' does not have a method 'install'

We've installed the Woocommerce Rapyd Payments plugin and have the issue that the payment option is not loading on the front end. Query Monitor is showing the above warning message, but I haven't been ...
0
votes
1answer
26 views

Response from Php File to Ajax is not getting sent

I am trying to send some response from Php script to Ajax, but it is not getting sent.Below is my code. For now I am sending dummy data which I will change later.. Php Script.. $response = ['...
1
vote
0answers
29 views

how to search users by ajax live search

in short i want to search users with with help of live ajax search . i have written a code and it is working fine but that code is for searching posts by ajax, but i want to search users from ...
0
votes
0answers
19 views

How can i do public ajax call?

I need to know exactly how the AJAX URL REQUEST works in wordpress my code : php (in function.php): add_action('wp_ajax_nopriv_wpa56343_search_widget', 'wpa56343_search_widget'); // for not logged ...
1
vote
1answer
25 views

how to send Ajax request in wordpress backend

On the fronted the wp_localize_script seems to be working as when I view the source I can see the nonce. wp_localize_script('scripts', 'myAjax', array( 'root_url' => get_site_url(), '...
0
votes
0answers
6 views

Do i need a folder to post files?

I am trying to send a file to a site using an api call. You fill out a form with name, email and attach a file then you press "apply". When you press the "apply" button, the name, ...
1
vote
1answer
46 views

Ajax contact form widget plugin data not insert in database

I have been working at this for weeks without success. I've figured out problem after problem with the code, but none of the corrections seem to fix my core problem. The form doesn't insert anything ...
2
votes
0answers
40 views

Nonces, AJAX, script variables & security in WordPress

Alright, so let's say you develop a website where you enqueue a js script on a page X of your frontend, using: wp_enqueue_script( 'script_handle', PATH_TO_SCRIPT, array(), '1.0.0', true ); ...
0
votes
0answers
11 views

Boilerplate - Run js function onClick button

I am using the boilerplate generator for first time and I have a problem. On my edit post page, I have created a custom button like this: admin/admin-class-myPlugin-admin.php public function ...
0
votes
0answers
12 views

How to pass value from ajax to php in no conflict mode?

I am trying to use ajax to pass value of the checklist to php in wordpress. I am using plugin to insert php on a page as a shortcode. Then inside the theme I created a js file with js/ajax code. I ...
0
votes
1answer
27 views

Compare $_POST returned values with term array

I am trying to compare Post values returned from AJAX with available taxonomy term_id but somehow I am out of luck. My $_POST['recvid'] values based on the user selection for example are '70=on&72=...
0
votes
0answers
11 views

Display products of category when it is clicked using AJAX

I was able to successfully list out a bunch of subcategories on a page (page_template.php). Where I am stuck: Now, I want to be able to select one of those subcategories on the page and have the ...
0
votes
0answers
28 views

Front-end user submit Custom Post Type with AJAX and ACF Fields

I am in need of some advice/nudging in the right direction to achieve the following: Logged in users will be able to either create new or edit existing posts from a custom post type. They will be able ...
0
votes
1answer
26 views

How to pass values from one function to the other using an array variable

Hello I have a function that passes values to other functions using javascript without reloading page. The first action of the javascript below gets values from a form and sends to php via a call back ...
0
votes
0answers
15 views

error inserting comment with AMP ajax

I found this code on the web but it gives me a 500 error when trying to insert a comment using AMP: > xhr-impl.js:86 POST > https://grama-cesped.com/wp-admin/comen2.php?action=...
0
votes
1answer
10 views

Call product search from custom hook

I am trying to make search request from my custom form. For this I have an AJAX call on form submit: jQuery("#header-search").on('submit', function () { jQuery.ajax({ url:...
0
votes
1answer
28 views

How to prevent multiple post with same meta value being created simultaneously in Wordpress (with ajax)

I'm trying to make my own appointment system for WordPress. For this, I created a post type called "appointments". When users select a service from the service list, the available dates and ...
0
votes
0answers
14 views

Select2 throws an error on ajax call

What I am doing is: jQuery(function () { jQuery("#make").select2({ allowClear : true, placeholder : "Make", ajax: { url: my_ajax_object....
0
votes
1answer
18 views

Status 400 for AJAX POST Request with admin-ajax.php

I've been on this problem since yesterday, writing and rewriting my code to fix this 400 XRH error. I cannot find a way to fix it. Before showing you the code, here's some context: I am trying to add ...
0
votes
0answers
11 views

Sending referrer URL via WordPress AJAX in vanilla JS

Let's say you have a form. On submit, you coded the page to submit the form data to a given data base, by holding the data in a json object, like so: myData = {first_value: value1, second_value: ...
0
votes
0answers
15 views

Wordpress nonce failed sometime

I have generated the nonce key in the HTML form using the following function - wp_nonce_field('test_form_action', 'test_form_field'); and posted all the form data along with nonce value to server side ...
1
vote
4answers
138 views

Async Loading of Custom Posts

I have a wordpress page template, where I'm loading custom posts. The code for fetching these custom posts looks as follows: template-parts/content-page.php <article id="songs"> &...
0
votes
0answers
17 views

Using wp_send_json_success instead of $result['message'], die, etc

My usual ajax function looks like this: function get_modal_playlist_classplan( $odv_video_id ) { check_ajax_referer($_REQUEST['nonce'], "my_cool_nonce", false); $result['type'] = &...
0
votes
1answer
37 views

Forbidden Error in ajax call with wordpress

I'm getting 403 error in my plugin develop when I try to use ajax calls. I had disabled all plugins and activated default theme, no works. I have no cache plugin, and I have no server cache. I get: ...
1
vote
2answers
86 views

$wpdb working with ajax but showing ajax error instead of success

Will someone guide why this code doesn't work. Even the data gets changed. Here is the ajax I use. jQuery(document).ready(function($) { $(".ue_ajax_enabled").on('click', function(event) {...
0
votes
1answer
76 views

In a plugin, How to update a json file using ajax

Context Learning plugin creation, i want to save the content of a div each time the user click outside of it. In a nutshell, the purpose is to create a text backup of a notepad. I'm working in Local. ...
0
votes
0answers
25 views

How to run an ajax call in elementor editor

I am having a strange issue. I am not able to execute an ajax call while in Elementor edit mode. add_action( 'wp_ajax_slug_configureheader', [ $this, 'rename_configureheader_callback' ] ); add_action( ...

1
2 3 4 5
50