Sample XHR request to portelt

This is the sample of how you can send the XHR request to the portlet and call its serveResource() method. Click here to download sample portlet

The sample in Infocenter about _portletWindow.newXMLPortletRequest never works. Even though i can see the XHR request my callback does not get called.

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<%@ taglib uri="" prefix="portlet"%>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
<portlet:defineObjects />
<div id="test">initial text</div>
<script language="JavaScript">
function handleOnClick(){
console.log("Exiting handleOnClick");
url: '<portlet:resourceURL/>',
load: function(data){
console.log("load is called");
dojo.byId("test").innerHTML = data;
error: function(data){
console.log("error is called")

console.log("Exiting handleOnClick");
<p><input type="submit" name="Test" value="Test" onclick="handleOnClick()"></p>

No comments: