javascript - Wordpress ajax and extra php scripts -
i have simple form building wordpress site , cant seem figure out doing wrong. using ajax call separate php script generic function.php script(i called wpplugin.php) handle form data cant seem figure out if javascript file or url ajax not triggering. so have 3 files, have /wpplugin.php , /upload.php /code/upload.js. to add js file use code in wpplugin.php: add_action( 'wp_enqueue_scripts', 'all_enqueue_scripts' ); function all_enqueue_scripts() { wp_enqueue_script( 'uploadjs', plugins_url( '/code/upload.js', __file__), array('jquery'), '1.0', true ); } and ajax js script follows: $("#uploadform").on('submit',(function(e) { e.preventdefault(); $.ajax({ url: "upload.php", type: "post", data: new formdata(this), contenttype: false, cache: false, processdata:false, success: function(data) ...