You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by he...@apache.org on 2012/10/25 04:54:09 UTC
svn commit: r1401958 -
/airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html
Author: heshan
Date: Thu Oct 25 02:54:09 2012
New Revision: 1401958
URL: http://svn.apache.org/viewvc?rev=1401958&view=rev
Log:
Update UI.
Modified:
airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html
Modified: airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html?rev=1401958&r1=1401957&r2=1401958&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html Thu Oct 25 02:54:09 2012
@@ -29,6 +29,19 @@ Gatekeeper Endpoint : <input type="text"
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script>
+ function xmlToString(xml) {
+ var xmlData = $(xml);
+ var xmlString;
+ if (window.ActiveXObject) {
+ xmlString = xmlData.xml;
+ } else {
+ var oSerializer = new XMLSerializer();
+ xmlString = oSerializer.serializeToString(xmlData[0]);
+ }
+ console.log(xmlString);
+ return xmlString;
+ }
+
$(document).ready(function(){
$(window).load(function () {
$("div").hide();
@@ -66,13 +79,36 @@ Gatekeeper Endpoint : <input type="text"
alert(hostAddress);
alert(xmlString);
- var string
- $.post("http://localhost:7080/airavata-registry-rest-services/registry/api/hostdescriptor/save",
+ $.ajax({
+ headers: {
+ Accept : "text/plain; charset=utf-8",
+ "Content-Type" : "text/xml"
+// "Content-Type": "text/plain; charset=utf-8",
+// "Accept-Encoding" : ""
+ },
+ type: "POST",
+// contentType : "application/x-www-form-urlencoded",
+ url: "http://localhost:6060/airavata-registry-rest-services/registry/api/hostdescriptor/save",
+ data: xmlString,
+ dataType: "xml",
+ cache: false,
+ error: function() { alert("No data found."); },
+ success: function(xml) {
+ alert("it works");
+// alert($(xml).find("project")[0].attr("id"));
+ }
+ }).done(function( msg ) {
+ alert( "Data Saved: " + msg );
+ });
+
+// $.post("http://localhost:7080/airavata-registry-rest-services/registry/api/hostdescriptor/save",
+
+ /*$.post("http://localhost:6060/airavata-registry-rest-services/registry/api/hostdescriptor/save",
{ host: xmlString} ,function(data,status){
// TODO : REST api should send some response back in case of a successful invocation of service.
// alert("Data: " + data + "\nStatus: " + status);
- alert("Button 2 clicked !");
- });
+ alert("button2 post sent !");
+ });*/
});
});
</script>