Support » Plugins » Hacks » Need jquery/ajax help for form fields

  • Kacomp


    Hi there,
    I am writing a plugin to extend an existing plugin called appointments+
    You use it to book appointments eg, hairdresser. I am extending it so you can add extra fields in the booking form. The booking form using ajax. Now I can create new fields in the form but I just cant seem to get the value of the text input. I am using the following code to get the value
    var app_test_field = $(“.appointments-test-field-entry”).val();
    Now this works fine for a checkbox but not for text field. I feel I am missing something fundamental about how Ajax works. an anyone shed light on why this is failing?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    It depends on what you want to do with the entered values and how the appointments plugin handles form data. Typically all form elements are sent as an array, so if your added elements are inside the form tags there’s a good chance the values are reaching the server.

    What happens at the server also depends on the appointments plugin. If it saves all values as a single array, your values will be stored as well. You just need to figure out how to access them. This is less likely, array values are often parsed out for separate handling, so you probably need to handle your portion of the data by hooking into the same ajax action (assuming the plugin is correctly using WP style AJAX) used by the plugin. var_dump($_POST); to see if your values are being sent and how to access them.

Viewing 1 replies (of 1 total)
  • The topic ‘Need jquery/ajax help for form fields’ is closed to new replies.