Foren
ajax resource response is gibberish
Michael Anthony Dorrian, geändert vor 12 Jahren.
ajax resource response is gibberish
Junior Member Beiträge: 98 Beitrittsdatum: 03.09.09 Neueste Beiträge
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, geändert vor 12 Jahren.
RE: ajax resource response is gibberish
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
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, geändert vor 12 Jahren.
RE: ajax resource response is gibberish
Junior Member Beiträge: 98 Beitrittsdatum: 03.09.09 Neueste Beiträgejelmer 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..