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]
- What’s the difference between HTML ‘hidden’ and ‘aria-hidden’ attributes?
- What does do?
- Is there a way to convert SWF to HTML5
- How to call a PHP function on the click of a button
- Wrap text around bootstrap image
- CSS hover effect is not working on my code
- center aligning a fixed position div
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- HTML Entity Decode
- link with target=”_blank” does not open in new tab in Chrome
- My CSS won’t link to my HTML file
- jQuery sort elements using data id
- send mail to multiple receiver with HTML mailto [duplicate]
- Rails button_to vs. HTML Button Tag
- Stray end tag “head”
- How to create a text box in PHP to output data
- Auto refresh code in HTML using meta tags
- Multiple lines of input in
- Set textarea width to 100% in bootstrap modal
- How to set “style=display:none;” using jQuery’s attr method?
- “The Events Calendar” plugin by Modern Tribe in WordPress not working
- How to manage ajax calls and JSON in wordpress
- How to add a ” waiting” icon for an ajax in WP frontend?
- call shortcode in javascript
- woocommerce target button with class after ajax update
- Not sure why wp_ajax isn’t working?
- Load created php file data via ajax
- How to add a button that enables the user to insert a link in a textarea located in the front-end?
- In WooCommerce product archive, how can you also set the quantity to be added to cart by typing, instead of just by using +/-?
- AJAX pagination, update current page
- adjust section according to country?
- Return an array from get_terms and store as JavaScript array for search autocomplete
- Display wordpress post’s in popup?
- WP http XML response HTML encoding and image display problems
- Using WP_Query to grab custom meta values, foreach to json object
- Using color picker in plugin, does input attribute order matter?
- How to pass parameters from jQuery ajax into PHP function?
- WP AJAX post filter > do something with empty value
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Get uploaded image and attach it to the new post
- Convert bookmarks.html file into WP posts
- Admin-ajax php not working on new wordpress version
- With wp_list_category put every existing category into an option tag
- No Object Properties sending form through AJAX
- Redirect wp_dropdown_pages() to an AJax request?
- Add a counter for mouseovers (custom field)
- get content from page through AJAX
- What file is the tag located in Genesis default theme?
- AJAX calendar navigation returns -1
- Show preview of wordpress posts on external html sever
- Query data after an Ajax insert
- Ajax result show in console if is called outside function and not showing in array
- How to submit the date with ajax?
- Applying metatag to single page
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- how add class in containers
- Add HTML between feed items
- WordPress ajax not working in registration
- Link opens a new website instead of my own
- Ajax call does not work for this custom code
- ajax form function error
- ACF repeater image in video poster with jquery
- can’t make jQuery work (change image on time interval) [closed]
- Moving from Microsoft Front Page 2003 to WordPress
- Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php