Handling an Ajax form submit

You should remove the link from the anchor tag: <a class=”button” href=”#” style=”background-color:white;color:black;”> <strong>Submit</strong> </a> Then your jQuery part should be: $(‘a.button’).click(function(event){ event.preventDefault(); //your ajax gets here: jQuery.ajax({ type:”post”, dataType:”json”, url: ajaxurl, data: {action: ‘submit_data’, info: info}, success: function(response) { alert(“Success”); } }); });

Calculate Repeater Meta Box Input Field Values and Display Total

You need to loop through the values of each input and add them together. You can do this using a each. Try this. Replace your calculate function with this. calculate = function(){ var total = 0; $(‘.wpp-repeater-input’).each(function () { total += parseInt($(this).val()); }); document.getElementById(‘wpp_investment_total’).value = parseInt(total); } On a side note: I would remove the … Read more

Run Product Filter Javascript On Page Template

In WordPress, you should use wp_enqueue_script() to load JavaScript files, and wp_enqueue_style() to load CSS files, and the functions should be called using the wp_enqueue_scripts action hook. Additionally, the theme needs to call wp_head() (in header.php) and wp_footer(). And to enqueue a script only on specific pages, you would use a conditional tag like is_page() … Read more

how would I include a js file with tags into wordpress?

First you should use the wp_enqueue_scripts to load your scripts. add_action( ‘wp_enqueue_scripts’ , ‘javascript_file-exmp’ ); Second, be sure to both register and then enqueue your script Register: wp_register_script( ‘links’, plugins_url( ‘test.js’, __FILE__ ), array( ‘jquery’ ), ‘1.0’, true ); 1.0 is the version, used mainly to avoid caching on when you update it. true controls … Read more

Data fetch and delete by ajax request

Why yo don’t you replace HTML again, when you edit or delete any record! What you can do here: Once the edit/delete query, you have to write query for fetch the data again from SQL and replace using ajax response.

wp_enqueuescript won’t load in footer even with true value set?

You need top put it into an actual function and then call the function via an action, but to answer your question. wp_register_script(‘easy-slider’,get_bloginfo(‘template_directory’) . “/js/easySlider1.7.js”, true); Your setting the third parameter to true but that param is for the $deps (dependency). The footer is the 5th parameter called $in_footer. So it should be: wp_register_script(‘easy-slider’,get_bloginfo(‘template_directory’) . … Read more

How to include admin-ajax when loading external javascript

What you need to do is register and/or enqueue your script and then use wp_localize_script to include a Javascript variable on your page. The Codex page has this example: wp_enqueue_script( ‘some_handle’ ); $translation_array = array( ‘some_string’ => __( ‘Some string to translate’ ), ‘a_value’ => ’10’ ); wp_localize_script( ‘some_handle’, ‘object_name’, $translation_array ); You can then … Read more