工具/软件:Code Composer Studio
您好!
我正在开发 一个与 Concerto 板合作的网页、其中我需要对两个数据进行交换。 我可以一次将一个参数从网站发送到 Cortex M3 (服务器)、而不会出现任何问题、但我需要一次发送大量参数。
我的问题是: 您知道如何将参数数组传递给服务器吗?
下面显示了用于发送我已实现的参数的代码。
CCS 代码。
//
struct fs_file *
fs_open (char * pcName)
{
const struct fsdata_file * ptTree;
struct fs_file * ptFile = NULL;
//sprintf (name);
//
//为文件系统结构分配内存。
//
ptFile = mem_malloc (sizeof (struct fs_file));
if (NULL == ptFile)
{
返回(空);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// Valores 的 Obtencion //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (strncmp (pcName、"/cgi-bin/sendSnom、17)=0){
Set_Snom (((char*) pcName + 17);
//返回(NULL);
UARTprintf (pcName);
}
///---------------- Envio de Datos //
if (strncmp(pcName,"/cgi-bin/getData?id,7)=0){
静态 char pcBuf[6];
get_snom (pcBuf);
ptFile->data = pcBuf;
ptFile->len = strlen (pcBuf);
ptFile->index = ptFile->len;
ptFile->pextension = NULL;
return (ptFile);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
------------------------------------------------------------------
JavaScript 代码
//函数仅发送一个参数
函数 enviar_Datos(){
var req = false;
VAR 标称= document.getElementById ("Snom");
if (window.XMLHttpRequest)
{
REQ =新的 XMLHttpRequest();
}
否则 if (window.ActiveXObject)
{
REQ =新的 ActiveXObject ("Microsoft.XMLHTTP");
}
if (req)
{
REQ.open ("get"、"/cgi-bin/sendSnom +标称值+"id"+ MATH_random()、true);
req.send(null);
get_datos();
}
}
函数 get_datos(){
VAR Snom1 = false;
函数就绪()
{
if (Snom1.readyState == 4)
{
if (Snom1.status = 200)
{
document.getElementById ("valor_U").innerHTML ="
}
}
}
if (window.XMLHttpRequest)
{
Snom1 =新的 XMLHttpRequest();
}
否则 if (window.ActiveXObject)
{
Snom1 = new ActiveXObject ("Microsoft.XMLHTTP");
}
if (Snom1)
{
Snom1.open ("get"、"/cgi-bin/getData?id=+ Math.random ()、true);
Snom1.onreadystatechange =就绪;
Snom1.send(null);
}
}
此致
Marcelo