Using WebPlayer i am passing 2 screenshots into a javascript function in the browser, but for some reason the data always is undefined in javascript. Doesn’t matter if i pass byte[ ]'s or strings. Any ideas why? Below are my 2 scripts. Tested it on Opera and Firefox. Javascript is enabled on the browser.
Using Unity 3.5.6 Pro.
// c# code
public void SendEmail(string emailBody, byte[] layoutPic, byte[] legendPic)
{
_emailBody = emailBody;
layoutData = layoutPic;
legendData = legendPic;
//StartCoroutine(CallPHP());
string layoutBase64 = System.Convert.ToBase64String(layoutData);
string legendBase64 = System.Convert.ToBase64String(legendData);
//Application.ExternalCall("Redirect", layoutBase64, legendBase64);
Application.ExternalCall("Redirect", "xxxx", "yyyy");
//StartCoroutine(snapShotCam.ScreeAndSave());
//Invoke("KillPanel", 1.5f);
}
// javascript code
function Redirect(layoutData, legendData)
{
var newDialog = "<div id='dialog'></div>";
//var dialogContent = "<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>";
var dialogContent = "<p> LayoutData </p><p>"+layoutData+"</p><p> Legend Data </p><p>"+legendData+"</p>";
//var dialogContent = "<p>"+layoutData+"</p>";
$('body').append(newDialog);
$('#dialog').html(dialogContent);
$('#dialog').dialog({modal: true, draggable: false, resizable: false, title: "Personal Info", height: 700, width: 700});
}