<link href="~/css/bulma.css" rel="stylesheet" />
<link href="~/css/bulma.min.css" rel="stylesheet" />
<script src="~/js/jquery.min.js"></script>
<script>
	$(function()
	{
		$("#btnsend").click(function()
		{
		   let cmdtype=$("#txtcmd").val();
		   let id=$("#txtid").val();
		   let data=$("#txtdata").val();
		   console.log(data)
		   let aaa=  {
				Cmd: "tcp_send_data_clientid",
				Parameterlist: {
					"device_clientid": id,
					"command_word":cmdtype,
					"data":data
				}
			};
			let YUI=	JSON.stringify(aaa);
			$.ajax({
				//url: 'http://localhost:5116/api/sockettcp/send_data_to_targetnew',
				url: 'http://iot-manage.uts-data.com:5001/api/sockettcp/send_data_to_targetnew',
				type: 'Post',
				//contentType: 'application/x-www-form-urlencoded',
				contentType: 'application/json',
				data: JSON.stringify(aaa),
				success: function(response) {
					console.log(response);
				},
				error: function(xhr, status, error) {
					console.log(error);
				},
				beforeSend: function(xhr) {
					console.log('Sending request...');
				},
				complete: function(xhr, status) {
					console.log('Request completed.');
				}
			});
		});
	});
</script>
<div class="field">
	<label class="label">设备CID：</label>
	<div class="control">
		<input id="txtid" class="input is-primary"
			   type="text"
			   placeholder="Primary input" />
	</div>
</div>

<div class="field">
	<label class="label">命令字：</label>
	<div class="control">
		<input id="txtcmd" class="input is-primary"
			   type="text"
			   placeholder="Primary input" />
	</div>
</div>
<div class="field">
	<label class="label">数据:</label>
	<div class="control">
		<textarea id="txtdata" class="textarea"
				  placeholder="10 lines of textarea"
				  rows="10"></textarea>
	</div>
</div>

<button id="btnsend" class="button is-link">发送</button>
