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
0
votes
0answers
22 views

Is there a way to add ajax hooks without editing the functions.php file?

I am using the plugin code snippets and I'm quite liking it. Except for the fact that when I want to register an ajax hook it will try to register after all the hooks are registered by WordPress. I ...
-1
votes
1answer
45 views

Why does my Ajax Get request give a 400 bad request?

I'm quite new to Wordpress and I am trying to do an ajax request inside a code snippet from the code snippet plugin. The problem is that I keep getting a status 400 bad request. I found many people ...
1
vote
2answers
42 views

Fetching the value of forms in WordPress AJAX

I have a form with AJAX Submit. I am getting the value of fields as null. jQuery('#DownloadForm').submit(ajaxSubmit); function ajaxSubmit() { var DownloadForm = jQuery(this).serialize(); ...
0
votes
0answers
56 views

WooCommerce: How to add to cart a custom type product ( yith composite )

I'm building a mobile app and need to add products with ajax requests. My client using a custom product type called yith-composite that converting the products to parent and children ( component ) ...
1
vote
1answer
41 views

How would you update a frontend form with AJAX

I'm trying to build me own frontend AJAX updating screen mirroring interface. I have a very basic form: <form id="mblocation"> <input type="radio" name="mb_user_location" id="...
1
vote
0answers
38 views

JS innerhtml changing style when using AJAX

so I'm about to finish my first wordpress theme but I'm having a problem here. The main page of the theme shows some posts (audios, really). I've allowed two options: showing the 5 latest or the 5 ...
2
votes
0answers
30 views

Cannot search post by taxonomy

I'm trying to search posts by a taxonomy value, the problem is that the query doesn't return anything, this is my code so far: $args = array( 'post_type' => 'zoacres-property', '...
0
votes
0answers
25 views

Wordpress Ajax not returning Response

I have an ajax call which is working perfectly but is not returning any response below is how i registered my scripts wp_enqueue_script('wcp-signup-custom-js', WCP_PLUGIN_URL . '/WCP/FrontEnd/...
0
votes
0answers
22 views

how can I edit the HTML of yith ajax product filter

this question is basically the same as How to edit plugin's html? but they also did not get an answer to their question. I am using Yith AJAX Product Filter Premium Plugin and I am in contact with ...
0
votes
1answer
13 views

How to create custom search form function including post “tags”

This is my HTML: <input type="text" class="keyword" name="keyword" id="keyword" placeholder="Search video..."> <button id="search-keyword">Search</button> When I click the "Search" ...
0
votes
1answer
39 views

ajax-action.php can't find added action

Dear fellow Wordpress plugin developers, I'm currently developing a WordPress custom booking plugin. In this plugin, I have added a calendar shortcode, which embeds an Html month calendar on the page....
0
votes
0answers
24 views

Implement AJAX to fetch pages or posts content in a WordPress custom theme

I like to use ajax to fetch the content of a wordpress page inside my custom templates. I've read that it's necessary to pass all the call to fetch or get data throught the admin-ajax.php of wordpress....
0
votes
0answers
47 views

How to implement an infinite scroll or Ajax load more

My site is www.grubnglug.co.uk. I use geomywp to search/filter and display posts and do not want to change it. My question is, how can I implement infinite scrolling or Ajax load more button ...
0
votes
1answer
32 views

Data fetch and delete by ajax request

I have created a crud reservation form using ajax. The purpose of this form is when the user submits this from the user data will be stored in the database without page refresh. The full functionality ...
1
vote
1answer
141 views

How do I detect in which page ajax_query_attachments_args is loaded?

I'm trying to hide attachments with a taxonomy. I want to hide them from Post page in wp-admin. I can't figure out how to detect the page I'm in from ajax_query_attachments_args. I tried to use ...
0
votes
0answers
69 views

submit button not working after ajax

I've modified the woocommerce calculate shipping calculator form in the functions of my child theme by adding an email address to it. Currently on clicking submit all fields are being stored to the WC ...
0
votes
0answers
119 views

How achive serving multiple concurrent Ajax / Rest calls in plugin?

I am developing a plugin that does at some point gather a bunch of data from a bunch of other servers. So for each of these servers, there will be one ajax call in the frontend that expects xhr ...
0
votes
0answers
20 views

Static position inside an ajax-called loop

0 I am serving an output of five posts in my homepage and upon scroll down, I use an Ajax call to implement a load-more functionality, which loads a next series of 5 posts. So, upon scroll down, $...
0
votes
0answers
71 views

how to filter posts by category without page load (ajax) in wordpress?

I Tried this code, here: http://rankonone.com/dev/profdharm/monthly-rashifal/ August, October, September are categories, I want to show post below without page load where currently title and date. ...
0
votes
1answer
295 views

Change WooCommerce currency programmatically on AJAX request

I am adding a custom ajax_action to fetch a product and display price html (same template as everywhere else on my page), the issue is that the price being returned is not equal to the current price ...
1
vote
1answer
25 views

Populate a Map at The Same Time as showing Posts via AJAX

I have a map search page on my site. I'm able to display all the locations in a list in HTML but I am struggling to pass the locations to JavaScript at the same time in order to populate the pins on ...
0
votes
0answers
1k views

Update / refresh mini cart, after custom AJAX add_to_cart event

I need help In my custom single-product.php template, I added the button public function AddToCartButton() { global $product; if($product->is_type('variable') || $product->...
2
votes
0answers
175 views

Solve cors problem using rest api or ajax

I'm building an app with nuxt using WP as a CMS, so I have this code in my functions.php to allow any origin (temporary) using the rest api and admin-ajax urls function add_cors_http_header(){ // ...
0
votes
0answers
51 views

wp_ajax_ 400 Bad Request

Trying to run a ajax request back to a function and keep getting a 400 error. this is the code below wp_register_script('frontend_js', plugins_url('/js/frontend.js', __FILE__), array(), false, ...
1
vote
0answers
31 views

Load MediaPlayerElement after Infinity Scroll loads more posts

I am using Infinite Scroll on a site that is using a custom styled MediaPlayer Element (using Wordpress' built-in MediaElements.JS). The style initially loads fine, but once Infinite Scroll loads ...
1
vote
1answer
94 views

Using Ajax to load more posts | Help me change the wording on my button to notify the user

I am having bit of a brain melt situation trying to carry across a style of code I used on a previous website where I would change the wording on the button the user clicks to load more. I have ...
0
votes
0answers
34 views

AJAX content that only appears while the customizer is open

While this is likely specifically a WooCommerce issue, it still applies here. I am using the AJAX add-to-cart feature, so, upon clicking "add to cart," items should be added to the cart (this part ...
0
votes
0answers
17 views

Suggested JS Framework for WP Plugin Development

Currently, when creating WP Plugins, I use a lot of basic JS, with jQuery and ALOT of AJAX requests… Can you please suggest a framework that I can use instead that will make things much easier and ...
1
vote
0answers
31 views

Ajax date_query not working past the first iteration

I cant find anything on stack overflow that covers my issue, after hours of debugging and checking answers to similar questions but not quite the same scope, I cannot figure out the problem. ...
0
votes
0answers
73 views

Pass JavaScript value to PHP [duplicate]

How to step JavaScript value to PHP? The value (passValue) Or the value you have on the "on " or "off " button for here $testup = (passValue); Sorry bad English <button id="toggle" name="...
0
votes
0answers
204 views

How to update cart total after AJAX success

I am making a customized shopping cart. The Ajax code is updating record correctly. However, I am unable to update/refresh the cart total to reflect the changes made by the user until reloads the page....
0
votes
0answers
18 views

How do I append options to a select box in the customiser from an API call?

I'm working on a WordPress theme and I've added a select box to allow users to select a font for their site. I figured I'd use the Google Fonts API to grab the list of fonts rather than add all 900-...
0
votes
2answers
142 views

Wordpress Heartbeat API cannot parse data

I want to use WP-API heartbeat to open a connection to two displays and have them reflect what the other is saying with each send and tick. It used to work when the heartbeat API came out in 3.6 - ...
0
votes
1answer
44 views

Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error

I have been working on this for hours and can find no solution. I have a website that uses a custom post type named 'Brands', which has a taxonomy named 'brand-categories'. At my client's request, I ...
0
votes
0answers
619 views

AJAX to add to cart multiple products woocommerce

I found some AJAX on here to add a product to cart through WC through a button click, and I am trying to modify it to be able to add multiple products with the single click. I am not super familiar ...
0
votes
0answers
37 views

Does wp_verify_nonce check ajax form referrer url?

I have a form "accept request" that is displayed conditionally when the accepter clicks on a unique link that was sent via email from the sender. ?> <form id ="accept" action="<?php echo ...
0
votes
0answers
15 views

Frond-end mini-framework for handling wp ajax

The question is non-specific. I have been doing lots of custom triggers to handle ajax and its responses from WP core. Is there perhaps some lightweight framework that could facilitate that? I would ...
0
votes
0answers
15 views

Metabox - update Post - save duplicated rows to database

I have created a custom_post_type with a Metabox where i can duplicate rows / items with jquery and i can sortable them. Now i want when i save the post, that the content (input fields) are saved. I ...
2
votes
1answer
602 views

admin-ajax.php HTTP400: BAD REQUEST - The request could not be processed by the server due to invalid syntax

Update 1: Based on suggestions from Rup and Jacob, I changed the data of the ajax request to this (including the entire function and not just the ajax request this time): //updated code with ...
0
votes
0answers
15 views

wordpress upload image and set as featured

I would need your help since I'm getting "crazy" as I can't figure out how to do this. Basically I have an ajax call that sends an URL and name to PHP function that uploads the file. It's supposed to ...
0
votes
0answers
230 views

Not getting ajax success response on insert/update row to database

I am not getting success response after inserting/updating record to the database. Instead ajax returning error: function(response) with Something went wrong! message. $this->gs_db is the ...
0
votes
1answer
49 views

How to add Ajax to this Pagination i made?

This is my functions file add_action( 'wp_ajax_homekong_pagination', 'homekong_pagination' ); add_action( 'wp_ajax_nopriv_homekong_pagination', 'homekong_pagination' ); function homekong_pagination($...
0
votes
0answers
47 views

Submit form for loop of products of the term with AJAX

I am developing a group shopping cart that allows group user to order from the group page. I have a product term page where user can buy all products at one time. In fact, they must have to buy all ...
0
votes
1answer
77 views

Get response for check_ajax_referer

I want to show the notice to the user if the nonce check fails using check_ajax_referer. However, the function dies itself if fails. So I just wonder that if I die using wp_die() manually will that ...
0
votes
0answers
36 views

400 Bad request while submitting form using AJAX

I am poor in AJAX and trying to submit the form and insert the record to the custom table since a couple of days but not getting it to work. I am getting 400 Bad request error on console. Please have ...
0
votes
0answers
12 views

How to progressively update a plugin admin div using ajax?

Thanks to this seven-year-old tutorial from Pippin Williamson, I have just learned how to live-load content in to an admin-side plugin page, using ajax. My plugin sets up a management page (Tools) ...
1
vote
0answers
37 views

How to get original custom taxonomy slug after the slug has been rewritten?

I'm writing ajax handling for a theme. I'm trying to get term and taxonomy slugs from a link I click. The link is being passed with jQuery to PHP for further processing. Let's say my custom taxonomy ...
1
vote
1answer
196 views

How to insert a record by clicking on the link using AJAX

I am developing a plugin for WordPress. Looking for a solution I want to insert record (it may be any CRUD operation) when the user click on the link order-button I am very much new to Ajax so ...
0
votes
0answers
21 views

Adding user using admin ajax by a user with custom role

I have a form in which user A with a custom role is able to invite other users. Javascript which handles that looks like this: sendNotificationEmail(newUserId) { newUserId = parseInt(newUserId)...
1
vote
0answers
42 views

How can I use cached images in an AJAX response?

WP_AJAX includes no-cache headers with its responses. I'm using Ajax to fetch part of a shopping cart, which includes little image thumbnails. On each Ajax request, these are replaced and we can see ...

1
3 4
5
6 7
47