Ajax Plugin Not Echoing Response

This is the final code I am using. Thanks to webaware for pointing out that I was not using the correct datatype. jQuery(document).ready(function($) { $(‘.audience_intel_container .close’).click(function(){ $(‘.audience_intel_container’).fadeOut(‘fast’, function(){ }); }); $(‘.audience_intel_container button’).click(function(){ console.log(‘clicked’); var formdata = $(‘#audience_intel_form’).serialize(); $.ajax({ type : “post”, dataType : “html”, url : audience_intel_js.ajaxurl, data : ‘action=audience_intel&’+formdata, success: function(response) { alert(response); $(‘.audience_intel_container’).html(response); … Read more

Form action URL unrecognized

I would like to recommend you to read The Rewrite API: The Basics article. Especially pay attention to the Add Custom Endpoint section where you can find how to create what you need.

How can I redirect this contact form to a specific permalink

If your form has been incorporated into WordPress as a page template, which I encourage, then get_permalink(8); // or 12 should do it. If not, then http://example.com/?p=8 and http://example.com/?p=12 should always work. http://example.com/?page_id=8 and http://example.com/?page_id=12 uses the proper parameter for pages but ?p= works fine when I test it.

Where to add css file that I want my forms to use?

Use wp_enqueue_style to add additional stylesheets to a theme. Additionally, you can use it with a Child Theme to preserve your edits in case the original theme is updated. function wpa_form_style() { wp_enqueue_style( ‘my-form-styles’, get_stylesheet_directory_uri() . ‘/my-form-styles.css’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_form_style’ ); or if you only need your styles for a specific page, conditionally … Read more

Using admin-ajax prevents regular php form submission

You can change the form action to admin-ajax.php?action=your_action and this will work, but it’s not best practice. The ajax submition should be added via javascript, not by changing the form action (also your js function should prevent the form from submiting normally, returning false – see here an example: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/), and php handling of the … Read more

Submitting form in wordpress plugin

Reviewing wp_dropdown_users() there is apparently a ‘selected’ parameter. So in theory, you could probably pass the posted value in here. // set to the posted value, but you might be able to do this differently, depending on how you are storing the data $selected = isset($_POST[‘author’]) ? $_POST[‘author’] : false; $args = array( ‘name’ => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)