In jQuery.post, how do I get value of variable outside function?

前端 未结 2 1535
醉梦人生
醉梦人生 2020-12-20 05:40

I have the following function:

var id = \"10\";
var type = \"Type A\";
var img = \"myimage.jpg\";

jQuery.post(\"my/path/somefile.php\", { instance: \'getUrl         


        
2条回答
  •  醉话见心
    2020-12-20 06:27

    You should be able to do exactly what you have there - globals are visible inside functions unless there's already a local variable of the same name declared.

提交回复
热议问题