Commit bb8aa0da authored by Maxime Chaillet's avatar Maxime Chaillet

fix request for doi in detailsDOI2.html

parent 67d1b7c2
......@@ -12,39 +12,18 @@ var connection= {
}
var mySessionId="";
var promiseSession;
$(document).ready(function() {
console.log("Hello. The document is ready.");
$("#doiRequestDiv").hide();
$("#connectButton").click(function() {
$("#getDoiButton").click(function() {
console.log("You clicked on Connection button");
// From: http://learn.jquery.com/ajax/jquery-ajax-methods/
// Using the core $.ajax() method
$.ajax({
// The URL for the request
url: "https://linfalcon.esrf.fr:8181/icat/session",
// The data to send (will be converted to a query string)
data: connection,
// Whether this is a POST or GET request
type: "post",
// The type of data we expect back
//dataType : "text",
dataType : "json",
// Code to run if the request succeeds;
// the response is passed to the function
success: function( data ) {
console.log("You received some data!");
mySessionId = data.sessionId;
$("#connectionState").html("Your session ID is " + data.sessionId);
$("#doiRequestDiv").show();
},
// Code to run if the request fails
error: function() {
alert( "Sorry, there was a problem!" );
}
});
promiseSession = askSession();
});
$("#getDoiButton").click(function() {
console.log("getDoiButton clicked");
......@@ -80,6 +59,29 @@ $(document).ready(function() {
});
});
function askSession(){
return $.ajax({
url: "https://linfalcon.esrf.fr:8181/icat/session",
data: connection,
// Whether this is a POST or GET request
type: "post",
// The type of data we expect back
//dataType : "text",
dataType : "json",
// Code to run if the request succeeds;
// the response is passed to the function
success: function( data ) {
console.log("You received some data!");
mySessionId = data.sessionId;
$("#connectionState").html("Your session ID is " + data.sessionId);
},
// Code to run if the request fails
error: function() {
alert( "Sorry, there was a problem!" );
}
});
}
function receptionDOIInfo(data){
if (data.length != 0)
{
......@@ -107,13 +109,10 @@ function receptionDOIInfo(data){
</head>
<body>
<h1>Salut</h1>
<p>Cliquer sur le bouton pour connexion sur ICAT server.</p>
<button id="connectButton">Connexion</button>
<div id="connectionState"></div>
<div id="doiRequestDiv"> Enter the requested DOI :
<input type="text" id="doiId">
<button id="getDoiButton"> Get it !</button>
</div>
<div id="doiResultDiv"> </div>
<p>Donner une DOI et cliquer sur le bouton pour recuperer les info sur cette doi sur ICAT server.</p>
<input type="text" id="doiId">
<button id="getDoiButton"> Get it !</button>
<div id="connectionState"> </div>
</body>
</html>
\ No newline at end of file
......@@ -49,10 +49,9 @@ $(document).ready(function() {
$("#getDoiButton").click(function() {
console.log("getDoiButton clicked");
var doiRequest = $("#doiId").val();
var myDoiQuery = "select distinct dcd from DataCollection dataCollection" +
" join DataCollectionDatafile dcd" +
" where dataCollection.doi='" + doiRequest + "'";
//" include dataCollection.parameters";
var myDoiQuery = "select distinct dataCollection from DataCollection dataCollection" +
" where dataCollection.doi='" + doiRequest + "'" +
" include dataCollection.parameters";
$.ajax({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment