Loading jquery from google doesn't work (for me)

前端 未结 6 691
盖世英雄少女心
盖世英雄少女心 2021-01-16 20:25

Ah the wretched noob I am, the following html document doesn\'t alert anyone of my cry for help. Anyone know why?





        
6条回答
  •  忘掉有多难
    2021-01-16 21:07

    This works for me:

    
    
    
    
    
    
    
    
    

    Just fixed the src in the script tag.

    Edit: Actually, the original syntax would work fine if you load the page in a non-local context. Leaving out the protocol implies that the 'current' protocol would be used depending on whether resources are loaded over http or https. Loading it locally implies that the script is loaded from file:///ajax.googleapis.com/...., which obviously won't resolve to anything. See here for more information. Thanks to @PetrolMan for pointing to the HTML 5 boiler plate site.

提交回复
热议问题