i think the script.js
file is not loading properly. if its loading then the function should work as expected.
are you referencing the complete path of script in your script.js call? like
<script type="text/javascript" src="https://wordpress.stackexchange.com/questions/256287/some-domain.com/path/widget.js"></script>
try opening that file from page source and see if its loading the correct js file?
its always best practice to use wp_enqueue_script
function for loading js files.
Related Posts:
- Most efficient way to add javascript file to specific post and/or pages?
- Pass media upload value to input field
- Real time Duplicate title check
- Load custom field value into div with AJAX
- Jquery ajax to custom php file: returning blank data
- jQuery functions only work on homepage
- Looking for a better way to handle an ajax script that pulls in post data on click
- How can I loop into two different DIVS without repeating the DIVs
- Display notification only once
- Access/update database with jQuery
- Using wp_localize_script to store the template url into a variable to use in JS
- How to add a dynamic javascript snippet to the footer that requires jQuery
- Why is this Ajax not working?
- Stumped – Ajax Response Returns 0
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Parsing php string in jquery [closed]
- doing an ajax request always outputs 0
- Using shipped version of jquery
- How to show a dynamic_sidebar if main content content’s height is > a set amount?
- Woocommerce add to cart quantity buttons with AJAX
- class click counter save number
- wordpress count link clicks by ip address
- Is there a way to programmatically create multiple pages utilizing the same template but different content from a json file?
- Ajax load more posts with multiple tax query
- WordPress Sending data to Ajax with select option
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- populate form fields in a loop with ajax
- Gravity form built in Captcha
- Post repeating with infinite scroll
- Plugins not working on AJAX requests
- How to disable controls in theme customizer?
- JQuery calling a Custom PHP function (Works in Dev but not in WordPress)
- Jquery function working in Dev Console but not otherwise [duplicate]
- WordPress Ajax Call inserting data but success response false
- How can i display a jquery slide on front page
- Unset session variable on page reload / setup but exclude AJAX
- Flexslider won’t work on WordPress
- jQuery Ajax PHP function call returning [object Object]
- jQuery accordion menu
- limit number of post for achive page
- Removed jQuery script from header.php , any problems?
- Execute Jquery when a specific page in my plugin is loading
- Covert WordPress Blogname into JQuery
- what does $options = get_option(‘test_theme’); do?
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Hot to check if new posts have been published since page load and notify online users?
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Custom html/php/jquery map code in WordPress/elementor?
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- how can i include post meta in search result
- How to send a php var to jQuery Ajax call with two different file
- WooCommerce Query Product Titles
- jquery & ajax getting data from php in wordpress . admin-ajax.php returns 400
- How to check a variable Changes
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- Dropdown Category form. Only show Sub-Categories
- Outputting post content to jQuery .html() string
- How to use wp_ajax_set_post_thumbnail?
- Customize the “Available for back order” text for specific variation
- If user has clicked link add class and store using PHP/WordPress
- Implement jQuery Smart wizard
- Woocommerce – if selected attribute term equals
- WordPress Slick Slider + Magnific Popup
- Show the subcategory name based on current product
- wp_set_object_terms returns 500 error when called through AJAX function
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- How to create an Email Subscription input in WordPress?
- getting the values of hidden inputs to use them in a php mysql query
- Styling a specific post after hovering over it
- Remove item from post_meta array via AJAX
- PHP array to jQuery array ” Uncaught SyntaxError: Unexpected token < "
- Creating Log-In Page for backend server
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- WordPress 404 when using AJAX to call php function
- wordpress ajax pagination
- how use php query in AJAX jquery
- Submitting my form to the database and then redirecting to payment site
- AJAX Not Working With WordPress Database properly
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- Pass the updated value of aid from form using ajax
- 500 (Internal Server Error) of external php file
- Use jQuery and AJAX to get HTML
- No Authors for custom post type
- Dynamic Gallery
- Missing items on page
- How to change links in the 3 main categories, on widget category, to a javascript function call
- jQuery vs. $ – Creating jQuery scripts in JavaScript in WordPress using External Libraries
- best way to communicate between php and jquery/javascript
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Cannot get custom javascript to execute on page
- why my “recepie” category is not taken into account in my request
- AJAX: WordPress filters inside $html do not work as intended
- Why not showing all post by default in my jquery filter
- Jquery autosave text area after typing
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Upload multiple files via ajax from an HTML file input
- get_post_meta returns on side but it doesn’t return on bottom of admin page