Foros de discusión
ajax resource response is gibberish
Michael Anthony Dorrian, modificado hace 12 años.
ajax resource response is gibberish
Junior Member Mensajes: 98 Fecha de incorporación: 3/09/09 Mensajes recientes
I basically want to create a download link and create the file as described here:
PDF Download Example
The following like the example shown in the link above works perfectly
Anyone have any ideas?...any other alternative ideas are also welcome
PDF Download Example
The following like the example shown in the link above works perfectly
location.href = '<portlet:resourceurl><portlet:param name="reportType" value="pdf" /></portlet:resourceurl>
[code]
But unfortunately because i am passing table data as a long formatted string for one of the parameters the method above breaks in this case even when encoding the url...
So the i tried to create an ajax equivalent(as seen below) which passes the parameters(even long) perfectly but the response returns gibberish..
[code]
jQuery.ajax({
type: "POST",
url: "<%=renderResponse.encodeURL(testURL.toString())%>",
data: {'reportType' : pdf} ,
success: function(response) {
//this should open a download excel dialog box but returns gibberish
location.href = response..responseText;
}
Anyone have any ideas?...any other alternative ideas are also welcome
jelmer kuperus, modificado hace 12 años.
RE: ajax resource response is gibberish
Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes
Something like this ?
Put it in an iframe if needed
<form name="<portlet:namespace />myForm" action="<portlet:resourceURL>" method="post">
<input type="hidden" name="reportType" value="what ever">
</form>
<script type="text/javascript">
document.<portlet:namespace />myForm.submit();
</script>
Put it in an iframe if needed
Michael Anthony Dorrian, modificado hace 12 años.
RE: ajax resource response is gibberish
Junior Member Mensajes: 98 Fecha de incorporación: 3/09/09 Mensajes recientesjelmer kuperus:
Something like this ?<form name="<portlet:namespace />myForm" action="<portlet:resourceURL>" method="post"> <input type="hidden" name="reportType" value="what ever"> </form> <script type="text/javascript"> document.<portlet:namespace />myForm.submit(); </script>
Put it in an iframe if needed
Thank you!!...worked perfectly..