Hi, The WEB server in the contribution is a good starting point.
You can also take a look at the conticki project. They also have a nice WEB server: http://www.contiki-os.org/ What I can suggest is building something similar to the SSI handling. SSI is implemented by adding a TAG in your HTML code. For example <!--#edid_set--> ... were the TAG is edid_set In your SSI (C code) you probably have a table that has pairs of TAG's and call back functions. When the WEB server handles a GET Request it sends back the file to the browser. While sending data it parses the HTML and when it finds the tag it call's the related call back to insert some dynamic data. In order to use the same mechanism use the following: Create an empty HTML page that only has one TAG in it (not data just the tag) ... say ajax_reply ... When the web server gets this it does not need to send back any HTML (remember the file is empty, apart to the tag !!) ... So the WEB server calls a call back function related to this tag. The call back function is handling ALL the AJAX requests Portions of what I mean: const SSI_t SSI_Table[] = { // tag, function call {"login", login}, //----------------------------------- {"sys_info", sys_info}, {"net_setup", net_setup}, //----------------------------------- {"ajax_reply", AjaxReply}, //----------------------------------- {NULL, NULL} // last tag must always be NULL to close the list }; The AjaxReply is handling all AJAX call's... in one function u16_t AjaxReply(HttpParams_t *HttpParams, char *pcInsert, int iInsertLen, u16_t current_tag_part, u16_t *next_tag_part) { char *paramActionValue = NULL; char *Password, *User; int RespLen = 0; paramActionValue = GetParamValue(HttpParams, "a"); // get action parameter from AJAX if(strcmp(paramActionValue, HTTPD_LOGIN_TAG_NAME) == 0) { User = GetParamValue(HttpParams, "user"); Password = GetParamValue(HttpParams, "pass"); RespLen = sprint(pcInsert, "true") } else if(strcmp(paramActionValue, HTTPD_FREQUENCY) == 0) { // some code here... } return RespLen; } The above is showing a simplified way how to handle an AJAX request from WEB browser that sends a user Name and password and returns true as data. The internal buffering allocation, data sending etc... is the same/similar to how you use to send the device HTML. Hope that helped. BR, Noam. -----Original Message----- From: lwip-users [mailto:[email protected]] On Behalf Of ece.kishor Sent: Thursday, September 22, 2016 6:28 AM To: [email protected] Subject: Re: [lwip-users] Dynamic page updation using Ajax-Issue Firstly thank you for your help and thank you for your approach. Are u have any successful example recommendations of ajax GET method inside internet. Thanking again Kishor Ravi [email protected] -- View this message in context: http://lwip.100.n7.nabble.com/Dynamic-page-updation-using-Ajax-Issue-tp27374p27382.html Sent from the lwip-users mailing list archive at Nabble.com. _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
