The action: 'ajax_contact'
part in:
var data = $form.serialize();
console.log(data);
$.ajax({
url: ajax_contact.ajaxurl,
dataType: 'json',
action: 'ajax_contact',
data: ajax_contact.data,
is most likely the cause here, that your ajax request is failing.
Move the action part into the data set instead.
Since you’re serializing the form data, you could try to add:
<input type="hidden" name="action" value="ajax_contact" />
into your form.
Also make sure the data attribute:
data: ajax_contact.data,
is getting the serialized data, but not the undefined ajax_contact.data
.
You can try with manual json string instead for testing.
ps: also consider using nonce for extra security.
Related Posts:
- WordPress AJAX File Upload – FrontEnd
- jQuery and AJAX Not working with Select Form Element
- Registration e-mail check with AJAX
- Accept AJAX call with serialized form data
- Frontend Post with JQuery AJAX to Php Issue
- Converting a working AJAX form to work with WordPress
- jQuery forms & updating info
- Is not using admin-ajax to ajax submissions okay?
- $_POST empty in using new php file added to theme
- jQuery form plugin, submit in the wordpress way
- Pass request headers in a jQuery AJAX GET call
- How to send multiple data fields via Ajax?
- Jquery Ajax Posting JSON to webservice
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- Validate form before submit jquery
- How to manage ajax calls and JSON in wordpress
- How to add a ” waiting” icon for an ajax in WP frontend?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- What is the simplest ajax upload plugin or script to be used with wordpress?
- WordPress Ajax URL for function in functions.php
- AJAX function returning -1
- call shortcode in javascript
- WP set auth cookie using Ajax is not saved to browser
- jQuery AJAX form validation
- Proper way to load a single post via Ajax?
- Add X meta box inputs based on form at top of meta box, how to do it right?
- Trying to get single posts to load on the front page via ajax
- ajax call in wordpress front end
- Ajax not firing properly using Firefox, but works in Chrome
- jQuery Ajax() doesn’t work when the page is accessed as a WordPress template page
- POST from jQuery to PHP
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- Creating custom AJAX requests
- How to pass jQuery ajax URL value
- how to get the comment ID in the front end when the REPLY button is clicked?
- Gravity Forms not loading under https, jQuery is not defined
- Gravity list field override and adding javascript [closed]
- Admin wp_ajax hook returning 0
- wp_verify_nonce not working
- Tags in WordPress 3.2
- php ajax problem – weird 301 responses!
- jQuery Ajax passing empty parameters to my function?
- WordPress customizer refresh screen after save
- Making the wordpress login form a jQuery dropdown
- How to get a value from PHP in Jquery through Ajax
- Not sure why wp_ajax isn’t working?
- Load created php file data via ajax
- WordPress Ajax problem with undefined url
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- AJAX Loaded Glossary like Search results with links to other entries from custom table
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- Return an array from get_terms and store as JavaScript array for search autocomplete
- Trouble with WordPress Ajax Login System – 302
- WP http XML response HTML encoding and image display problems
- Using WP_Query to grab custom meta values, foreach to json object
- Add/remove action on jQuery toggle
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- delete post meta by AJAX
- url – ajax loaded but no JS
- Creating a new div onclick wordpress+ajax
- how to json_encode(); the Loop content so that the encoded array is [“0”:content, “1”:content]
- Properly embed javascript into WP (using function.php) – doesn’t work?
- jQuery tabs plugin with callback to fetch data
- jQuery will not work on page from snippet or file
- JQuery Counter Limit not working for WP Comment Textarea
- No Object Properties sending form through AJAX
- Redirect wp_dropdown_pages() to an AJax request?
- Custom AJAX form not working async
- click event to unhide something after ajax not firing
- how to use wp_editor() here am getting empty result
- Manipulate retrieved ajax data in php
- Using AJAX to run SQL statement and populate dropdown
- problems with jquery external rss feed integration
- WordPress Front-End Theme Editor
- AJAX calendar navigation returns -1
- How to display contact form 7 form in vanilla js without jquery in frontend
- How to setup multi-page using jquery?
- Is textarea always accesible throught textarea#content in wordpress dashboard for a specific page?
- Auto next upon clicking image without clicking Next button
- Opening Modal popup on Ajax form submission
- How to submit the date with ajax?
- Get ajaxForm response value
- How to submit form data in the same page in WordPress without reloading the page?
- How to pull data from a table using wpdb?
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- How to specify url for ajax call in wordpress plugin
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Ajax Request with jQuery not happening
- Page keeps refreshing with Ajax form
- wp_signon not working fine and 302 moved temporarily?
- how to refresh index page without reloading browser using ajax
- Page reload occurs before request finishes
- Ajax request with jQuery without WP_ajax
- ajax form function error
- Contact Form 7 submission does not complete [closed]
- Using WP Ajax and jQuery to process multiple forms on the same page?
- Combo box populating a DIV using ajax/jquery
- Contact Form 7 checkbox to add a new class to a div [closed]
- Infinite Scroll applied to ajax loaded content
- Contact Form 7 – Submit Form not working After Ajax Request [closed]