Second instance of shortcode on page doesn't work
-
Hello,
I have created a plugin that sign up users to my Mail Chimp account using AJAX. I know there are Mail Chimp plugins out there, but none of them quite fit my needs, so I created my own. My intention is to display the form in a Modal window and that where AJAX comes in handy.
The form works perfectly until I place multiple instances on a single page. The first instance works as it should, but when I place more instances, the second, third…. doesn’t work. The main page gets submitted and the URL shows the query string of the form variables.
I suspect this is happening because the JavaScript code gets printed on the page more than once, where as if it is display only once, I believe that the multiple instances of my form should work. This is my thinking.
So, my question is how do I tell my plugin to only write out the JavaScript portion only once even though there may be more than one instance of the form on the page.
Any guidance will be greatly appreciated.
The topic ‘Second instance of shortcode on page doesn't work’ is closed to new replies.