Thanks to the talk with Sarfraz we could figure out the solution.
The problem was that I was passing an HTML element instead of its value, which is actually what I wanted to do (in fact in my php code I need that value as a foreign key for querying my cities
table and filter correct entries).
So, instead of:
var data = { 'mode': 'filter_city', 'id_A': e[e.selectedIndex] };
it should be:
var data = { 'mode': 'filter_city', 'id_A': e[e.selectedIndex].value };
Note: check Jason Kulatunga’s answer, it quotes JQuery doc to explain why passing an HTML element was causing troubles.
Related Posts:
- jquery ajax function not working
- Automatically pausing html5 video as the ‘next’ button is pressed (javascript/ jquery)
- Adding attribute in jQuery
- Set timeout for ajax (jQuery)
- Get the value in an input text box
- Get HTML code using JavaScript with a URL
- jQuery.addClass not working
- Get checkbox value in jQuery
- How to make a simple modal pop up form using jquery and html?
- Bootstrap throws Uncaught Error: Bootstrap’s JavaScript requires jQuery
- Refresh/reload the content in Div using jquery/ajax
- jQuery Scroll to Div
- jQuery checkbox event handling
- jquery – how to show a hidden div
- FormData append not working
- How to scroll to top of a div using jQuery?
- Check if a div exists with jquery
- Find out whether radio button is checked with JQuery?
- jQuery find element by data attribute value
- Scroll to bottom of Div on page load (jQuery)
- ajax live search for post title
- WordPress Ajax always returns a 404 error
- Load custom field value into div with AJAX
- Ajax Dynamic Archives not showing correct results
- Scripts not appending to element in AJAX call – why?
- echo custom fields with AJAX
- click event to unhide something after ajax not firing
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- How do I call a value from the datase using ajax
- How to use wp_ajax_set_post_thumbnail?
- Automatic add space if user enters number(any digit)
- Pass the updated value of aid from form using ajax
- Load Meta box value into div AJAX [duplicate]
- Contact Form 7 – Submit Form not working After Ajax Request [closed]
- How to reload a php script, using AJAX and jQuery
- Updating Jquery object with newly created elements after AJAX call
- WordPress Ajax not returning Response
- how can I edit the HTML of yith ajax product filter
- How to center entire columns on a page, and have it stay responsive?
- wp_ajax_ 400 Bad Request
- Scroll to ID broken in main menu
- AJAX to add to cart multiple products woocommerce
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- Getting click on item to open closest relevant element (popup) with jQuery
- How to pass array from jQuery to PHP with AJAX in WordPress?
- HTML block code breaking
- Download doccument on server rather than clients browser
- How can publish my bootstrap created table ( huge amount of data) on my word-press theme?
- checkout stripe with plugin contact form
- wp_set_object_terms returns 500 error when called through AJAX function
- Finding post ID dynamically on click
- Unable to autoplay and loop a cinemagraph from Imgur
- Infinite scroll without plugin using ajax
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- Images with overlay
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Random newlines inserted when pasting a chunk of HTML code
- Display html code, not the tags
- AJAX POST Value not being returned – WordPress – AutoTrader API
- WordPress ajax filter returning all posts when it should be filtering by category
- How to add an ID to an existing HTML element?
- Javascript output now showing in custom widget
- Many buttons not functioning in WordPress dashboard (as admin)
- How to use `foreach()` in ajax call
- Input field duplicates on form submit by jQuery
- Ajax call not working anymore
- 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?
- Where to find HTML to post Adsense Code
- Custom theme admin-ajax.php 400 (Bad Request)
- Displaying Post Content on tooltip
- Can’t get next post info with ajax
- Prevent markup being altered when switching between Visual and HTML editors
- Multiple Notifications SetInterval
- How to inject data content from external json into a modal, using UIkit?
- Remove item from post_meta array via AJAX
- HTML regex convert to titlecase
- Ajax by worpdress affects called jquery inside template file
- wp_ajax add_action fuction won’t fire on custom jQuery action
- number of posts with “Load More”
- Orderby post__in Not Working Correctly?
- Filterable posts using categories
- Ajax post doesnt call succes after got the response
- How to get values from Tinymce visual editor popup?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Get ajaxForm response value
- Overwriting Plugin’s Ajax callback function from theme
- WordPress Ajaxifying not working properly
- How to submit form data in the same page in WordPress without reloading the page?
- An extra is appearing in my source code–how do I diagnose the source?
- how to allow download after newsletter subscription?
- jQuery function not working in WordPress but works in jsfiddle
- wordpress ajax upload media not working
- Creating Log-In Page for backend server
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- Static HTML homepage, Link to WP installation
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX