This is an example of assigning a smarty array to a javascript variable:
{literal}
<script>
function assign_vals()
{
// alert(aa);
// alert(bb);
if(aa == '' || bb == '')
{
alert("Please upload an image first to cancel the upload");
}
document.cancel_upload_form.media_path_array.value = aa;
alert(document.cancel_upload_form.media_path_array.value);
document.cancel_upload_form.submit();
}
{if !empty($media_path_array)}
<form name="cancel_upload_form" action='{$action}' method='POST'>
<div id='cancel_upload' style='display: block;'>
<a href='javascript:void(0)' onclick="javascript:assign_vals()">{lang_print id=90000115}</a>
</div>
<input type='hidden' name='task' value='do_cancel_upload'>
<input type='hidden' name='media_path_array' value='{$aaa}'>
<input type='hidden' name='media_ids' value='{$media_ids}'>
</form>
{/if}
{literal}<script>var aa = '';</script>{/literal}
{foreach from=$media_path_array name=input_loop key=k item=v}
{literal}
<script>
aa += '{/literal}{$v}{literal}##';
// alert(aa);
</script>
{/literal}
{$v}##
{/foreach}
{literal}
<script>
function assign_vals()
{
// alert(aa);
// alert(bb);
if(aa == '' || bb == '')
{
alert("Please upload an image first to cancel the upload");
}
document.cancel_upload_form.media_path_array.value = aa;
alert(document.cancel_upload_form.media_path_array.value);
document.cancel_upload_form.submit();
}
{if !empty($media_path_array)}
<form name="cancel_upload_form" action='{$action}' method='POST'>
<div id='cancel_upload' style='display: block;'>
<a href='javascript:void(0)' onclick="javascript:assign_vals()">{lang_print id=90000115}</a>
</div>
<input type='hidden' name='task' value='do_cancel_upload'>
<input type='hidden' name='media_path_array' value='{$aaa}'>
<input type='hidden' name='media_ids' value='{$media_ids}'>
</form>
{/if}
Comments
Post a Comment