For me, Session with ajax working with the following code snippet
add_action('init', 'start_session', 1);
function start_session(){
if(!session_id()) {
session_start();
}
}
// form submition
add_action( 'wp_ajax_nopriv_form_response', 'form_response' );
add_action( 'wp_ajax_form_response', 'form_response' );
function form_response() {
$_SESSION['value'] = $_POST['formFiled'];
}
//Session value
if(isset($_SESSION['value'] ))
{
echo $_SESSION['value'];
}
Related Posts:
- WordPress Ajax always returns a 404 error
- Click loads template via ajax
- Display notification only once
- Access/update database with jQuery
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- How to speed up admin-ajax.php in wordpress
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Sending jsPDF documents to the server
- Ajax return code 400
- How to test nonce with AJAX – Plugin development
- class click counter save number
- AJAX request status 200 but no actual “response”
- Save Search System
- dynamic dependent select dropdown
- How to add a do_action on refreshing of WP customizer?
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Fancybox type popup window that’s not an iframe
- How do I Import / Upload Files with jQuery AJAX?
- WordPress Ajax Call inserting data but success response false
- Why i can’t get custom fields value or post ID via Ajax?
- Accessing an API with jQuery and AJAX
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- How to use wp_ajax_set_post_thumbnail?
- Update $wpdb query with AJAX
- AJAX to add to cart multiple products woocommerce
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- How to echo a PHP code into WooCommerce variation product?
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- How to call a function from functions.php with ajax?
- number of posts with “Load More”
- Find the method which AJAX GET calls
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- 500 (Internal Server Error) of external php file
- Dynamic Gallery
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- notify users when changed database
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- Retrieve POST data from AJAX call
- JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error
- problem with ajax and the path to the php page
- How to use wp_localize_script in a WordPress page other than functions.php?
- Ajax template: how to handle head section
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Update WordPress Custom Field with AJAX on cached page
- Targeting single page with JS
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- Returning a value from a PHP page
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- js file in root loading without
- Checking for new message using AJAX and PHP. Server overload?
- Change “add to cart” button color based on Woocommerce product category [closed]
- Ajax request returns ‘Array’. How to output the actual results?
- Ajax load more button for comments wordpress
- AJAX not Working with php as supposed
- Ajax contact form return 0
- AJAX – Returning Two JSON Objects with One PHP Function
- admin-ajax Firing Error 400 When Logged In
- Unset session variable on page reload / setup but exclude AJAX
- Add Ajax Hooks and Call from Custom Template PHP
- Making an AJAX call to refresh a table
- WordPress Ajax Always returning 0
- Jquery window.send_to_editor function
- How to add drag and drop functionalities to a div inside option panel
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Execute Jquery when a specific page in my plugin is loading
- Covert WordPress Blogname into JQuery
- what does $options = get_option(‘test_theme’); do?
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- Show the subcategory name based on current product
- wp_set_object_terms returns 500 error when called through AJAX function
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- ajax polling with admin-ajax.php
- Remove item from post_meta array via AJAX
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- How to load WP_Editor JS files manually (with AJAX)?
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- A javascript function that simply runs a php function on the plugin
- WordPress 404 when using AJAX to call php function
- wordpress ajax pagination
- how use php query in AJAX jquery
- Use jQuery and AJAX to get HTML
- Problems with plugin that fetches data from database with ajax
- Execute PHP code in Javascript onclick
- best way to communicate between php and jquery/javascript
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Cannot get custom javascript to execute on page
- AJAX: WordPress filters inside $html do not work as intended
- Why not showing all post by default in my jquery filter
- Jquery autosave text area after typing
- Remove Woocommerce product from cart with ajax/fetch
- WooCommerce Modal Fly cart on add to cart – With AJAX
- Upload multiple files via ajax from an HTML file input
- get_post_meta returns on side but it doesn’t return on bottom of admin page