Adding javascript functions to Laravel Mix ( and why you get error Uncaught ReferenceError: function is not defined )

This one had me pulling my hair out the other day. I was using Laravel,  adding a javascript function to the app.js file ( also tried using require in app.js and pulling in my function ). Laravel uses Laravel Mix which is a wrapper for webpack. Yet with either approach I was getting the javascript … Read more

How to add a form to a shortcode in WordPress (using PHP and Ajax)

Recently I needed to develop a Shortcode that would display a form, this blog post details what I did. I used Ajax ( which seems the best way to add forms to shortcodes, but I’d welcome any input from other developers on your approach). So without further ado lets get on with adding a form to … Read more

How to do Ajax in WordPress

updated 10th Jan 2018 Write a javascript function to trigger the ajax call

Put js above in my_js_file.js (see later in this post). Wrap in code below for nice loading: jQuery( document ).ready(function() {    put above code here     }); To see how to send a form via ajax see here.   Write a … Read more