That is not loading jQuery. It fetches whatever a random domain returns and echoes it straight into the page on every request. The error was just the malware host returning its own 404, printed onto the page in place of the usual payload (normally spam links or hidden SEO content). It rode in on a nulled “Pro” copy of All in One SEO Pack.
Pointing $url at the real code.jquery.com doesn’t fix anything, it just dumps the jQuery source as text onto the page, because the code echoes the response body instead of loading a script. The only real fix is to remove the nulled plugin and install the official free version from the WordPress plugin directory.
Watch out for this pattern: nulled (pirated) WordPress plugins routinely ship with a fetch-and-echo injector disguised as a jQuery loader. Sucuri has a good breakdown in Fake jQuery Scripts in Nulled WordPress Plugins, and All in One SEO publishes its own warning about nulled copies. A free “Pro” plugin isn’t free; the price is remote code running on your server.
“showPageLoadingMsg” will start to display the ajax loading message and “hidePage~” will close it. The stuff in the middle loads what the php file returns into a div, then creates DOM contents for it with the trigger(‘create’) function.
// this will make sure the datebox closes when the dialog closes$(document).delegate('#closeButton','click',function(){$(".ui-datebox-container").hide();$(".ui-datebox-screen").hide();});
Make sure your #closeButton is the same as the button which closes the dialog.
This project is a modification of the TodoMVC (used to sample how a language is structured by making a To-Do list). It adds database support and ends up being a very cool To-Do list.
At first, I loaded all of my scripts in the header (even when the scripts weren’t needed when the page was being loaded).
I found this website that partially explained how to load scripts when the page loads. However, Jquery Mobile needs to use the delegate function to load the script when a page is showing.
I copied the function from the website above:
functionloadjscssfile(filename,filetype){if (filetype=="js"){//if filename is a external JavaScript filevarfileref=document.createElement('script')fileref.setAttribute("type","text/javascript")fileref.setAttribute("src",filename)}elseif (filetype=="css"){//if filename is an external CSS filevarfileref=document.createElement("link")fileref.setAttribute("rel","stylesheet")fileref.setAttribute("type","text/css")fileref.setAttribute("href",filename)}if (typeoffileref!="undefined")document.getElementsByTagName("head")[0].appendChild(fileref)}
Now, you need to add code to the top of the data-role=”page” where you want the script to load:
Problem: In Jquery Mobile, I used the mobile.changePage (method) to switch pages. Now the button for the previous page is still blue.
Solution: Add Id’s to the list items you’ll be dealing with. Then use Jquery to remove the class “ui-btn-active” from the old button, and add the “ui-btn-active” class to the new button.
Problem: I had two different <script> (javascript) sections, and I was unable to pass a variable from one set of <script> tags to the other.
Turns out it doesn’t have anything to do with the script tags, and I just needed to learn a bit more about scope in Javascript. Apparently global variables are a common thing (maybe still not a good practice?) and as long as a variable is used outside of a function.. You’ll be able to access the variable anywhere on the page.
Solution: Take the variable outside of the function.