jQuery AJAX url path
This is my jQuery AJAX code and this javascript file is placed in
C:\workspace\search-ui\search-ui\src\main\webapp\themes\client\javascript\agile.js
And I want to call proxy.jsp file from this jQuery AJAX, and my jsp file is in
C:\workspace\search-ui\search-ui\src\main\webapp\WEB-INF\pages
so what will be the url field of AJAX call.. Any suggestions will be appreciated..
This AJAX jquery code is in Javascript file called agile.js and I have to call proxy.jsp page from this javascript file
var on_show_info = function() {
var outOfDomainAja开发者_Go百科xCall = search_metadata + current_doc_info.id;
alert(outOfDomainAjaxCall);
request_meta_info = $.ajax({
url: "proxy.jsp?url=" + outOfDomainAjaxCall,
type: 'GET',
success: on_get_metadata,
error: on_get_metadata_error
});
};
You are calling the script from: C:\workspace\agilesearch-ui\agilesearch-ui\src\main\webapp\WEB-INF\pages\search.jsp
And the page you are trying to reach is: C:\workspace\agilesearch-ui\agilesearch-ui\src\main\webapp\WEB-INF\pages\proxy.jsp
Change your code to:
var on_show_info_agile = function() {
//alert("aa");
var outOfDomainAjaxCall = search_agile_metadata + current_doc_info.id;
alert(outOfDomainAjaxCall);
request_meta_info = $.ajax({
url: "proxy.jsp",
data: "url=" + outOfDomainAjaxCall, //put the data here
type: 'GET',
success: on_get_metadata_agile,
error: on_get_metadata_agile_error
});
};
It should be:
"../../../WEB-INF/pages/proxy.jsp?url=" + outOfDomainAjaxCall
".../WEB-INF/pages" + outOfDomainAjaxCall,
type: 'GET',
success: on_get_metadata_agile,
error: on_get_metadata_agile_error
精彩评论