我可以使用字符串并将其替换为箭头指向下方的引号吗?
$(document).ready(function(){ $.ajax({ type: "GET", url: "http://mydomain/test.xml", <---- Right here can I use a variable like str dataType: "xml", success: function(xml){ etc...
答案 0 :(得分:4)
是的,你可以:
$(document).ready(function(){
var ajaxUrl = "http://mydomain/test.xml";
$.ajax({
type: "GET",
url: ajaxUrl, <---- Right here can I use a variable like str
dataType: "xml",
success:
function(xml){
etc...
答案 1 :(得分:1)
你的意思是:
$(document).ready(function(){
var someUrl = "http://mydomain/test.xml";
$.ajax({
type: "GET",
url: someUrl,
dataType: "xml",
success:
function(xml){
etc...