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.

0
votes
2answers
27 views

Ajax post returning full html page as response

I know that this has been frequently asked here, but none of the solutions I find seem to work for me. The issue is as follows: whenever I post the form, I have a console log with the response which ...
0
votes
1answer
17 views

Wordpress AJAX PHP(html) file that is within Wordpress Loop

I have a Wordpress AJAX call that is working in as much as it is able to get raw data from a PHP file. The AJAX is using the admin-ajax.php file. However, the PHP file I need to get is within the loop ...
0
votes
1answer
10 views

checkout stripe with plugin contact form

I have an issue with stripe, i am using the plugin contact form 7 stripe & paypal addon, but when i fill the form with my bank informations and i click on checkout button the page is stuck and the ...
0
votes
1answer
31 views

Ajax a php file that has Advanced Custom Fields in it

I am trying to AJAX in a php file that uses Advanced Custom Fields fields, and get a 500 internal error when making the request. The php file works fine if I just use ‘include’, but I need to have it ...
0
votes
1answer
20 views

use a single nonce in three different nonce field

i want to use a single nonce in three different form (login, register, lost password). But I am not sure how to use nonce in wp_localize_script( $handle, $object_name, array() ). In here $handle ...
0
votes
1answer
22 views

wordpress admin ajax trash_comment

I'm trying to add a trash_reason when someone delete a comment from the wp admin. I managed to add a thickbox with a dropbown listing deletion reasons and passing / updating the value of selected ...
0
votes
0answers
14 views

Lazy Loading using Pagination

im doing a lazy loading with WP_Query Pagination it's working fine but the content duplicate itself when it reaches it's end here is my code lazy-load.php <?php add_action('...
0
votes
1answer
25 views

Why my Ajax events are no longer detected after dynamic change of shortcode content

I have two input select (dropdown) in the content of my shortcode. The first is created when initializing the shortcode content, while the second is created when the user chooses the value of the ...
-1
votes
0answers
25 views

AJAX error at XforWooCommerce plugin less compiler [URGENT!]

I buy XforWooCommerce plugin but it all the time cause a some "AJAX error!" on CSS compiling and all logs points that error occur at/by less-compiler. XforWooCommerce developer Mikhailovich Nenand are ...
0
votes
2answers
32 views

What's the latest I can hook into wp_ajax_%?

It seems that there's a dispatch on shutdown, so, it seems that wp_ajax_my_action is executed at the very last of the request but I can't be sure since it doesn't show in the normal actions viewer. ...
-1
votes
0answers
12 views

Newspaper theme: How to make blocks filter by custom post and taxonomies

By default tagdiv newspaper theme not support filter by custom post or custom taxonomies in ajax filter in blocks. Any help please?
0
votes
1answer
19 views

Is it possible to bind a function to a filter hook via Ajax?

I'm trying to bind a function to a filter hook via Ajax, like that: function ajax_called_function_contains() { add_filter( 'wp_handle_upload', 'save_landscaped_version_of_img' ); }; The goal ...
0
votes
0answers
18 views

How To Display PHP Loop Data Using jQuery or PHP?

i have this php file i want to show same input field in both place, actually what i want, i want an input box after question, sample field $clue.="<input type='text' id='field_2'>"; i want to ...
0
votes
0answers
10 views

Loading Youtube Video Methods

I have a post grid where i can make the youtube video grids but if loaded directly it results in a very slow website. Also ends up javascript render block. In WordPress how can this be handled? Is ...
1
vote
1answer
74 views

class click counter save number

When the user clicks class count the counter should work: <div class="pop-btn" class="counter"><a href="https://www.example.com">Know More</a></div> <div class="count">&...
0
votes
1answer
27 views

Fatal error: Uncaught Error: Call to undefined function wp_nav_menu()

I am getting this error which Fatal error: Uncaught Error: Call to undefined function wp_nav_menu() in /home/stageidg/public_html/idg/wp-content/themes/idg-child/secondmenu.php:2 Stack trace:...
0
votes
1answer
38 views

WordPress AJAX return 0 - My case

My problem is the same as in other cases, but my code is fine, I compared with another and followed all the instructions and good practices, but it does not work. Here my code: jQuery("#genera-pdf")....
0
votes
1answer
27 views

Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework

I am using the WordPress Plugin Boilerplate to show a form to the user via shortcode. I am just a little confused of the flow of data not so much the syntax to do it. My Main Public Class has a ...
1
vote
1answer
29 views

wp_localize_script not working on ajax response

When a file is uploaded to my page I make an ajax call to add an entry in a database. I then want to send a string back to the client using wp_localize_script but when I try to access it I just get an ...
-1
votes
0answers
25 views

Proper way of calling AJAX from plugin

I am currently doing it like this and I know that this isn't the right way. I have 2 plugin files which will be named as index.php and process.php. index.php will show the form while process.php ...
-1
votes
2answers
26 views

Ajax Request for both logged and non logged users

As my understanding, The wp_ajax_{action} hook only fires for logged in users. For logged-out users, wp_ajax_nopriv_{action}action is triggered on an ajax request. So, how can I write for both logged ...
0
votes
1answer
20 views

AJAX button action in foreach

I have loop foreach, where i write data and buttons. This code work only from one button, first in loop and the rest does not work. JS: jQuery(document).ready(function($) { jQuery('#...
0
votes
0answers
14 views

AJAX unloads all posts at once - trable

Good afternoon. Make loading posts via ajax, everything is fine, but! Displays when scrolling immediately on 200+ records and many duplicates, how to fix the code below, I would be very grateful for ...
0
votes
1answer
37 views

AJAX button run function

I want after click button run function, . All is in one class. JQUERY jQuery('#text2').click(function() { var data = { 'action': 'myfunction', 'whatever': $button.data('text2'), ...
0
votes
0answers
14 views

wp_set_object_terms returns 500 error when called through AJAX function

I created dropdowns on the front-end to allow an admin user to change the custom post taxonomy values. On a save button click it runs an AJAX call to a separate PHP file. $.ajax({ type: 'POST', ...
1
vote
1answer
15 views

Can a wp_nonce created from domain 1 to be verified on domain 2?

From the Domain 1 i want to make an AJAX request to Domain 2. I would like to create a wp_nonce on Domain 1 and send it with AJAX request to Domain 2, then verify it on Domain 2. The 2 domains are ...
0
votes
1answer
40 views

Finding post ID dynamically on click

Goal: I'm making a portfolio website in Wordpress. It's the first time that I have setup a Wordpress page by myself (I have done on internship but those were template-ish). I have seen this website ...
0
votes
0answers
15 views

Customise GravityForm Field to accept multiple entries

I need to customise an input field in GravityForm to be like the highlighted part of the screenshot https://snag.gy/LIOsoh.jpg The input field will have a dropdown to add Adults, Infants and Children ...
1
vote
0answers
11 views

Why is on status span no search results?

i have written some jQuery code for my wordpress plugin : jQuery("#kd_nr_search").autocomplete({ minLength: 2, source: function (term, response) { jQuery.post({ url:...
0
votes
0answers
10 views

Finding Address based on Selection [migrated]

function createREQ() { try { req = new XMLHttpRequest(); } catch(err1) { try { req = new ActiveXObject("Msxm12.XMLHTTP"); } catch(err2) { try { ...
0
votes
0answers
8 views

Use data from API call to populate post_data to support the Social Warfare plugin in an hybrid SPA wordpress

I'm trying to figure out how to have Social Warfare use something different than $post_data, or to use a filter to change $post_data to what I want before it gets used. Our website has two parts: ...
0
votes
1answer
21 views

ajax problem - function on server is not called

This is a plugin for a specific shipping method for woocommerce. I'm trying to add a form into a new shipment method for WooCommerce I create. In that form I wan the user to enter street and postal ...
0
votes
1answer
31 views

Custom Shortcode AJAX 400 Bad Request

I'm writing a custom shortcode that will need to call some PHP file via AJAX, after some user event. But I am getting Bad Request 400 as if my wp_ajax_* actions aren't being bound. Here is a simple ...
0
votes
1answer
27 views

AJAX call of function containing javascript which is not loaded (Plugin development)

I have written a plugin which has a usermanagement page in the backend. This page loads userdata from the database by an AJAX call. The data returned from this function does contain HTML with class ...
0
votes
0answers
20 views

Using existing ajax data that is loaded into page

Hey guys thanks in advance, is there a js function that I can use on an existing data that was generated by a plugin with an ajax request ? Iv checked it is loaded with the network tab. but I'm not ...
0
votes
0answers
41 views

How can I set cookies on my posts so that I can get view count of that post [duplicate]

Can anyone help with the solution? This is my post and I have created a custom column to get view counts on my single post. I'm want to keep a track of views for every single post. I'm trying to set a ...
1
vote
1answer
32 views

How to add WP API and JS featured image attachment

I would like to fetch the image from the wordpress rest api - I have the following code: HTML: <div class="post-item"> <div id="posts">Loading posts... </div> Ajax script: <...
0
votes
1answer
25 views

AJAX error handling for submit function in functions file

I have created a custom function in my functions.php to handle form submissions for a Mailchimp subscriber list. I am making an AJAX call in my JavaScript to process the PHP. The problem I am facing ...
0
votes
0answers
54 views

Infinite scroll without plugin using ajax

I've created an infinite scroll without using any plugin to achieve the objective. The problem is that the bootstrap masonry cards grid are loading all the posts cards at the first scroll or will load ...
0
votes
1answer
16 views

How can i send id of the currently posted form data through json response in custom wordpress plugin?

I've used wp_send_json() to send the currently posted form data but cannot find a way to send the id attached to it which is incremented automatically from the database,, so that i can update the ...
1
vote
0answers
27 views

Which allowed API hooks work to add wp_ajax action?

Each time I have to add an ajax function in a WordPress plugin, I lost time to know what is the problem. So I decided to wrap add_action("wp_ajax{$function_name }", array( $function_class, $...
0
votes
0answers
31 views

Load default image on button click via AJAX

I'm trying to load a default image into a custom field on button click using AJAX. I've created a CPT and assigned some custom fields using ACF to the CPT. One of the fields is an Image field to ...
0
votes
0answers
9 views

How to add pagination to wpbakery grid?

I have a theme with wpbakery page builder. I made a page to display blog posts using wpbakery grid. But I would like to display 5 posts per page and to use ajax pagination. I display 5 posts per page ...
0
votes
0answers
44 views

Custom ajax file upload returns 403 error on wp-admin/async-upload.php

I've built an AJAX file uploader for the WordPress backend using WP's own async-upload.php. This was working fine, but after coming back to it after a couple of WP updates it seems to have broken. The ...
0
votes
0answers
17 views

Can't update WooCommerce payment method title

Trying to update the WooCommerce payment method as part of an AJAX call. I'm currently running this line; function ajax_payUsingVCAccount(){ update_post_meta( esc_attr( $_POST['order_id'] ), '...
0
votes
0answers
17 views

WordPress ajexified button to load post, I have code just need some modification

Working of the below code:- It shows the recent 5 posts from news category and the button is ajexifed which load the older post of news category. Can anyone help me with this, The below code is ...
0
votes
1answer
24 views

WP_Query based on another query on the page

I have a query that checks for a custom field set on that page and then creates a carousel to loop them with a background image. What I then want to do, is query a post type that uses a custom ...
1
vote
0answers
15 views

eventON plugin AJAX call triggers website crash

The eventON event listing plugin causes our website to crash when switching between months. The browser indicates that it is trying to load the site, but nothing ever appears. The plugin is inserted ...
1
vote
0answers
11 views

wp.template() returns <script> tags in Ajax response

I'm using the wp.template() to create a BackBone JS template which comes with WordPress by default. I have a template defined as: <script type="text/html" id="tmpl-pre-registration"> <...
0
votes
0answers
22 views

Why the responseText containing those two arrow signs at the beginning

this responseText is containing two arrow signs. But I didn't gave it in die("") in php Because of it iam having a problem to show error message in ajax And copy pasting this "↵↵You have reached ...