Make variable inside of a function available for other functions and strings to use

Downin'

New Member
I have a variable "mediaId" declared yet in my console it keeps telling me that it is undefined. What am I doing wrong?\[code\]var mediaId;//load the XML!$.ajax({ type: "GET", url: '10461632.xml', // path to XML file dataType: "xml", success: function(data) { $(data).find('Root').each(function(){ $(this).find('Item').each(function(){ mediaId = $(this).attr('videoMediaId'); // get the mediaId console.log(mediaId); }); }); }});\[/code\]in my "jsonApiCall" var it tells me it is undefined. \[code\]var jsonpApiCall = "http://www.domain.com/search_media/?format=jason&school=" + vid_partner + "&media_id=" + mediaId + '';\[/code\]Thanks so much!
 
Back
Top