Is it possible to change the "src" attribute of an existing element <script>using jquery.attr ()? It seemed like a simple way to get JSONP to work, but I can't do this work for me.
<script>
It turns out that a script srccan only be set once ! Unable to change the attribute of an srcexisting element <script>in the DOM. However, a dynamically created element <script>can have its own source set (but exactly once !)
src
If you are trying to load a script, you can use getScript instead.
http://api.jquery.com/jQuery.getScript/
, src , script , data-id, HTML5, src. src, attr. script .
data-id
, , , , jQuery JSON-P. . $.getJSON $.ajax .
$.getJSON
$.ajax