I have a file called wfd.proxy.js that contains the following lines of code :
if (!WFD) { var WFD = {}; };
if (!WFD.Proxy) { WFD.Proxy = {}; };
WFD.Proxy =
{
SERVICE_URL : "/delegate/WFD/WFService?",
PDF_SERVICE_URL : "/delegate/pdf-exporter?",
DATA_TYPE : "json", // used by jQuery
DATA_TYPE_EXT : "ajax", // used by ExtJs
DATA_TYPE_TXT : "text", // used for tests
SaveWorkflow : function(code)
{
jQuery.ajax({
url: WFD.Proxy.SERVICE_URL + "task=savemodel",
data: { code : code },
dataType : WFD.Proxy.DATA_TYPE,
type: 'POST',
success : function(data) {
WFD.Proxy.OnSaveWorkflowCallback(data);
},
error : function(jqXHR, textStatus, errorThrown) {
alert("Errore di comunicazione: " + errorThrown);
}
});
}
,
WFD.Proxy.OnSaveWorkflowCallback = function(data)
{
/*
data.response
data.message
data.model_new_id
data.idsNodes[i].original_id
data.idsNodes[i].new_id
*/
}
};
I have written the code that converts an xml file to JSON format. The JSON string that i get from the code I've written until now, should be passed as the code parameter of SaveWorkflow : function(code)
.
I'm not really sure what do I have to do at this point. I did some searches and saw that jQuery.ajax() calls where manipulated using Java Servlets ...
Any idea how to resolve this please? Thanks in advance
What you've written is client side code (ie executes in your browser). The part that's missing is the server side. Your "ajax call" is making an asynchronous connection to a web server, using this URL:
/delegate/WFD/WFService?task=savemodel&code=xxxx
xxxx is the value of the code variable. Your javascript is expecting a text string as response from this URL.
You don't need a servlet per se to handle this. Any web server that accepts the ajax URL and returns the required data will do (eg PHP...)
If you need a servlet and you don't know how to build one, I think you have a lot of reading to do. I suggest: https://www.google.be/search?q=my+first+servlet
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.