我是第一次使用dojo并使用1.7版。现在从dojo进行服务调用需要将请求方法从GET更改为POST。对于当前我正在使用 dojo / io / script 的GET请求,对于POST,应使用由以下人员建议的 dojo / request / script https://dojotoolkit.org/reference-guide/1.10/dojo/io/script.html。但是 dojo / request / script 在dojo 1.8中引入。是否还有其他方法可以调用POST类型或需要与dojo 1.8一起使用?谢谢,请帮助我解决此问题。
答案 0 :(得分:0)
最好不要使用namespace ConsoleApp2
{
class Gsmsms
{
private SerialPort gsmPort = null;
private bool isDeviceFound = false;
public Gsmsms()
{
gsmPort = new SerialPort();
}
public GSMcom[] List()
{
List<GSMcom> gsmcom = new List<GSMcom>();
try
{
ConnectionOptions option = new ConnectionOptions();
option.Impersonation = ImpersonationLevel.Impersonate;
option.EnablePrivileges = true;
// string conn = "Server=localhost;Database=election_db2;Uid=root;Pwd=;persistsecurityinfo=True;port=3306;SslMode=none";
string connString = $@"\\{Environment.MachineName}\root\cimv2";
ManagementScope scope = new ManagementScope(connString, option);
scope.Connect();
ObjectQuery query = new ObjectQuery("Select * from Win32_POTSModem");
ManagementObjectSearcher search = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection collection = search.Get();
foreach (ManagementObject obj in collection)
{
string portname = obj["Name"].ToString();
string portDescription = obj["Description"].ToString();
if (portname != "")
{
GSMcom com = new GSMcom();
com.Name = portname;
com.Description = portDescription;
gsmcom.Add(com);
}
}
}
catch(Exception x) {
Console.WriteLine(x);
}
return gsmcom.ToArray();
}
public bool Search()
{
IEnumerator enumerator = List().GetEnumerator();
GSMcom com = enumerator.MoveNext() ? (GSMcom)enumerator.Current : null;
if (com == null)
{
isDeviceFound = false;
Console.WriteLine("DEVICE NOT FOUND");
}
else
{
isDeviceFound = true;
Console.WriteLine("HUWAIE");
}
return isDeviceFound;
}
}
}
,并且根据documentation中列出的版本,不推荐使用此版本的1.8版本。
如果要调用特定的脚本文件以将其嵌入到页面或应用程序中,请使用dojo / request / script
因此,最好迁移到1.8
否则,如果您要调用返回data,html或某些结果的端点,
只使用dojo/request
dojo/io/script