|
Hi all
My friends written a small code's piece (see below) to call an ibm I's web
service and post a Json file; But when I run it for calling for example
Scott Klement INVSTAT (downloaded from
<http://www2.systeminetwork.com/code/index.cfm?fuseaction=ShowAllIssueCode>
http://www2.systeminetwork.com/code/...owAllIssueCode (July 2012 Source
Code)), in debug mode I see REQMETH fields with 'OPTIONS' value and the
inputXml empty. I Know that I for testing I could call my ibm I's web
service also with an RPG program , but we need to know how to call ibm I's
web service also from other server/device out of Ibm I world . Can some help
us to understand where the below code is not Ok.
Thanks in advance
<!DOCTYPE html>
<html>
<head>
<title>AJAX POST Form</title>
<meta charset="utf-8">
</head>
<body style="padding:10px; background-color:#ddd">
<div id="response">
<pre></pre>
</div>
<form id="my-form">
<input id="adress" name="adress"
value="http://192.168.1.10:12345/json.php" style="width:100%;
margin-bottom:10px;" placeholder="Adress" /><br>
<textarea id="content" name="content" style="width:100%; height:200px;"
placeholder="Content file JSON"></textarea>
<br><br>
<button type="submit" style="width:150px; height:40px;">Send</button>
</form>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></scr
ipt>
<script>
(function($){
function processForm( e ){
$('#response pre').html('');
$.ajax({
url: document.getElementById('adress').value,
dataType: 'text',
type: 'post',
contentType: 'application/json',
data: document.getElementById('content').value,
success: function( data, textStatus, jQxhr ){
var now = new Date();
$('#response pre').html( now + " Sent data " );
},
error: function( jqXhr, textStatus, errorThrown ){
$('#response pre').html( "ERROR: " + errorThrown );
}
});
e.preventDefault();
}
$('#my-form').submit( processForm );
})(jQuery);
</script>
</body>
</html>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.