掲示板

Ajax not working after page refresh

7年前 に Madasamy P によって更新されました。

Ajax not working after page refresh

Junior Member 投稿: 90 参加年月日: 16/07/27 最新の投稿
When I was clicking a button the ajax working at the first time
But after that refresh the page, the ajax not working

What is the problem?
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Ajax not working after page refresh

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Your code?
7年前 に Madasamy P によって更新されました。

RE: Ajax not working after page refresh

Junior Member 投稿: 90 参加年月日: 16/07/27 最新の投稿
David H Nebinger:
Your code?


<portlet:resourceURL var="reviewURL">
<portlet:param name="<%=Constants.CMD %>" value="review"/>
</portlet:resourceURL>

function review_art(){

alert("review Art");
AUI().use('aui-base','aui-io-request-deprecated', function(A){

//document.getElementById('tabs').style.display="block";AUI.use('aui-base','aui-io-request-deprecated',function(A){

A.io.request('<%=reviewURL.toString()%>',{

dataType:'json',
method: 'GET',
cache: false,

on:{
success: function(){
alert("Passed");
}
}
});
});
}


That's code working in individual page but when redirecting from view. JSP the problem occurred
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Ajax not working after page refresh

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
I can't even tell what the code is doing.

First it's all embedded in a function, but there's no clear indication the function is ever called. Plus the function is not namespaced so if any other portlet on the page also has a "review_art" function defined, they will step all over each other.

Along with that there's no server side code so there's no indication there is anything there for this method to call in the first place.

Is there anything in the logs indicating a failure of any kind?
7年前 に Madasamy P によって更新されました。

RE: Ajax not working after page refresh

Junior Member 投稿: 90 参加年月日: 16/07/27 最新の投稿
David H Nebinger:
I can't even tell what the code is doing.

First it's all embedded in a function, but there's no clear indication the function is ever called. Plus the function is not namespaced so if any other portlet on the page also has a "review_art" function defined, they will step all over each other.

Along with that there's no server side code so there's no indication there is anything there for this method to call in the first place.

Is there anything in the logs indicating a failure of any kind?


Yeah David

org.apache.coyote.http11.AbstractHttp11Processor processINFO: Error parsing HTTP request headerNote: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

This is the log message when requesting an ajax after refreshing


And I said clearly

My first page was view.jsp , which holds the files uploaded by user and one button (Ready for Review)
When I click the button it redirects to tagging_view.jsp along with file content from view.jsp

<liferay-portlet:renderURL var="URLName">
<liferay-portlet:param name="jspPage" value="/html/submission/tagging_view.jsp" />
<portlet:param name="isCKEditorView1" value="true" />
</liferay-portlet:renderURL>

<aui:form action="<%= URLName %>" name="fm1" id="fm1">
<aui:input id="content1" name="content1" type="hidden" />
<aui:button name="click" type="submit" value=Ready for Review"></aui:button>
</aui:form>

By using content value tagging_view.jsp opens CKEditor and we hold a button in the menubar of CKEditor as ClickMe

At the first time click the button the ajax works
after refreshing the page ajax can't working
This is my problem