This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/F28M35H52C: Send array from web-site to web-server

Part Number: F28M35H52C

Tool/software: Code Composer Studio

Hi,

I am developyng  a web-page for an aplicattion with Concerto Board where i need to exchang data beetwen both. I can send parameters one at a time from the web-site to the Cortex M3 (server) without problems but i need to send a lot parameters at a time.

My question is: Do you know any way on how to pass an array of parameters to the server?

The code for send a parameters that i am implemented is shown here below.

CCS Code.

//*****************************************************************************
struct fs_file *
fs_open(char *pcName)
{
const struct fsdata_file *ptTree;
struct fs_file *ptFile = NULL;
//sprintf(name);
//
// Allocate memory for the file system structure.
//
ptFile = mem_malloc(sizeof(struct fs_file));
if(NULL == ptFile)
{
return(NULL);
}

// /////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////Obtencion de Valores ////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////


if(strncmp(pcName, "/cgi-bin/sendSnom" , 17) == 0){

set_Snom((char*)pcName + 17);
// return(NULL);
UARTprintf(pcName);
}

//----------------------Envio de Datos---------------------//

if(strncmp(pcName, "/cgi-bin/getData?id" , 7) == 0){

static char pcBuf[6];

get_Snom(pcBuf);

ptFile->data = pcBuf;
ptFile->len = strlen(pcBuf);
ptFile->index = ptFile->len;
ptFile->pextension = NULL;
return(ptFile);

}
////////////////////////////////////////////////////////////////////////////////

.---------------------------------------------------------------------------------------------------------------------------

Javascript Code  

// Function to send only one parameter

function Enviar_Datos(){

var req = false;
var Snominal = document.getElementById("Snom");

if(window.XMLHttpRequest)
{
req = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if(req)
{
req.open("GET", "/cgi-bin/sendSnom" + Snominal.value + "id" + Math.random(), true);
req.send(null);
get_datos();

}

}

function get_datos(){

var Snom1 = false;

function ready()
{
if(Snom1.readyState == 4)
{
if(Snom1.status == 200)
{
document.getElementById("valor_U").innerHTML = "<div>" + "U = " + Snom1.responseText + "</div>";
}
}
}

if(window.XMLHttpRequest)
{
Snom1 = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
Snom1 = new ActiveXObject("Microsoft.XMLHTTP");
}
if(Snom1)
{
Snom1.open("GET", "/cgi-bin/getData?id=" + Math.random(), true);
Snom1.onreadystatechange = ready;
Snom1.send(null);
}

}

Kind Regards

Marcelo