Is there anyone else who is facing the same issue?
Or should I move the script into our server for the best experience? Please suggest.
You'd have to supply a URL. Can't troubleshoot your page without seeing it.
Thanks, Sire! Here is the link for Marketo page where the form is not loading: https://myfuture.sae.edu/js-testing.html (when we edit the page it's visible)
However, the same form is added on the website page as well and working fine. website page URL: Enquire Now
It's a clear race condition, because you're asynchronously injecting a (redundant) jQuery library and then trying to access it immediately. This doesn't happen on the other page because the jQuery library is also loaded earlier.
The best solution is of course to avoid using jQuery at all, since it distracts from learning real JS.
But if you must use jQuery, you still don't need to reload it in the Rich Text. The Forms 2.0 library already includes jQuery.
So you can remove
and use MktoForms2.$ instead of $.
As an aside, this is just terrible code:
If you're testing for the string "interactive", then test for the string "interactive"! Don't understand what would possess someone to look for the letters "in" anywhere in a string instead of the actual match. Such extreme "shortcuts" (which actually are bugs) are unacceptable on a professional site.
Thanks, Sir! I know on this website there are so many unacceptable things as stakeholder was managing it by themselves and they kept adding whatever code they wanted without noticing any further circumstances. I am trying to fix the things one by one.