What I am trying to do currently is pass a JSON string from the back-end C# to JavaScript to populate the drop down lists. What currently is happening is that when I use the information from the link provided, all i get in return is a literal output of ""<%= jsonFoodString %>". I do not understand why it is doing that. If someone can point me in the correct direction that would be great.
The current post I have been looking at:
Passing variable from ASP.net to JavaScript
The way I have been trying is (Example):
C# Code:
protected string jsonFoodString { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:63591/");
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.GetAsync("api/Meals/").Result;
if (response.IsSuccessStatusCode)
{
string foods = response.Content.ReadAsStringAsync().Result;
jsonFoodString = foods;
BindData();
}
}
}
Javascript:
var count = 1;
$(document).ready(function() {
$("#addItemButton").click(function() {
if (count <= 5) {
$("#ContentPlaceHolder1_AddMealContainer")
.append(
$("<div class=\"form-group\" id=\"MealItem_\"" +
count +
">" +
"<div class=\"row\">" +
"<label ID=\"AddItemLabel_1\" class=\"col-xs-4 control-label\">Item</label>" +
"<div class=\"col-xs-4\">" +
"<select ID =\"AddItemDropdownList_1\" data-html=\"true\" data-animation=\"true\" data-toggle=\"tooltip\" data-placement=\"top\" class=\"form-control\">" +
"</select>" +
"<div class=\"has-error\">" +
"<span class=\"help-block\">" +
"</span>" +
"</div>" +
"</div>" +
"</div>" +
"</div>")
);
count++;
var notParsedFoodString = "<%= jsonFoodString %>";
console.log(notParsedFoodString); //Produces a literal string of "<%= jsonFoodString %>"
} else {
alert("You can only add 5 food items to a meal");
}
});
$("#addItemButton").append("<input type=\"button\" value=\"Add Food Item\" id=\"AddMealItem\" class=\"btn btn-default btn-sm\">");
});
I found the answer I was looking for here!
XMLHttpRequest is deprecated. What to use instead?
var xhr = new XMLHttpRequest()
xhr.onreadystatechange = function() {
if (this.readyState === this.DONE) {
console.log(this.status) // do something; the request has completed
}
}
xhr.open("HEAD", "http://example.com") // replace with URL of your choosing
xhr.send()
Related
Ahoi,
I am hosting a small debug-website with my "Olimex ESP-32 POE". The goal is to send some internal data via JSON there to not have to use the Serial-Output from the Arduino IDE (The reasons behind that do not matter).
#include "Arduino.h"
#include <WiFiClient.h>
#include <WiFi.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <Update.h>
#include <string>
const char* ssid = "SSID";
const char* password = "password";
int looper = 0;
int looperSpeed = 0;
int looperMode = 0;
int looperDestination = 0;
int looperETC = 0;
WebServer webserver(80);
void initWebServer();
void getSettings() {
String response = "{";
response+= "\"speed\": \""+(String) looperSpeed+"\"";
response+= ",\"mode\": \""+(String) looperMode+"\"";
response+= ",\"dest\": \""+(String) looperDestination+"\"";
response+= ",\"etc\": \""+(String) looperETC+"\"";
if (webserver.arg("signalStrength")== "true"){
response+= ",\"signalStrengh\": \""+String(WiFi.RSSI())+"\"";
}
response+="}";
webserver.send(200, "text/json", response);
}
void handleNotFound() {
String message = "File Not Found\n\n";
message += "URI: ";
message += webserver.uri();
message += "\nMethod: ";
message += (webserver.method() == HTTP_GET) ? "GET" : "POST";
message += "\nArguments: ";
message += webserver.args();
message += "\n";
for (uint8_t i = 0; i < webserver.args(); i++) {
message += " " + webserver.argName(i) + ": " + webserver.arg(i) + "\n";
}
webserver.send(404, "text/plain", message);
}
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
initWebServer();
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// Set not found response
webserver.onNotFound(handleNotFound);
// Start server
webserver.begin();
Serial.println("HTTP server started");
}
void loop() {
webserver.handleClient();
//Some test values are changed here periodically (looperXYZ)
}
}
And the part which creates the website:
std::string online_output = "Test";
const char* serverIndex() {
const char* o = online_output.c_str();
const char* r =
(std::string("") +
"<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>" +
"<form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>" +
"<input type='file' name='update'>" +
"<input type='submit' value='Update'>" +
"</form>" +
"<div id='prg'>Progress: 0%</div>" +
"<div id='output' style=\"font-family: monospace; border: 1px solid black; width: 350px;min-height:398px;\">" +
"</div>" +
"<script>" +
"var id = 0;" +
"var removeId = 0;" +
"setInterval(function(){" +
/*"var xhReq = new XMLHttpRequest();" +
"xhReq.open('GET', '/JSON', false);" +
"xhReq.send(null);" +
"var jsonObject = JSON.parse(xhReq.responseText);" +*/
"var data = {};" +
"$.ajax({" +
"type: 'GET'," +
"url: '/JSON'," +
"data: data," +
"async: true," +
"beforeSend: function (xhr) {" +
"if (xhr && xhr.overrideMimeType) {" +
"xhr.overrideMimeType('application/json;charset=utf-8');" +
"}" +
"}," +
"dataType: 'json'," +
"success: function (data) {" +
"document.getElementById('output').innerHTML = \"<p id=\" + id + \" style='margin:0;padding:0px;'>\" + \"Mode: \" + fill(data.mode,2) + \" | Speed: \" + fill(data.speed,4) + \" | Dest: \" + fill(data.dest,4) + \" | ETC: \" + fill(data.etc,5) + \"</p>\" + document.getElementById('output').innerHTML;" +
// "if (document.getElementById('output').offsetHeight > 400) document.getElementById('output').innerHTML = \"<p style='margin:0;padding:0px;'>\" + data.name + \"</p>\";" +
"if (document.getElementById('output').offsetHeight > 400) { document.getElementById(removeId).remove(); removeId++;}" +
"id++;" +
"console.log(data);" +
"}" +
"});" +
"}, 50);" +
"function fill(n,m) { " +
"var pre=\"\";" +
"var dec=10;" +
"for(var i=1;i<m;i++) { if(n<dec) { pre+=\".\"; } dec*=10; }" +
"pre = pre + n;" +
"return pre; }" +
"$('form').submit(function(e){" +
"e.preventDefault();" +
"var form = $('#upload_form')[0];" +
"var data = new FormData(form);" +
" $.ajax({" +
"url: '/update'," +
"type: 'POST'," +
"data: data," +
"contentType: false," +
"processData:false," +
"xhr: function() {" +
"var xhr = new window.XMLHttpRequest();" +
"xhr.upload.addEventListener('progress', function(evt) {" +
"if (evt.lengthComputable) {" +
"var per = evt.loaded / evt.total;" +
"$('#prg').html('progress: ' + Math.round(per*100) + '%');" +
"}" +
"}, false);" +
"return xhr;" +
"}," +
"success:function(d, s) {" +
"console.log('success!')" +
"}," +
"error: function (a, b, c) {" +
"}" +
"});" +
"});" +
"</script>").c_str();
return r;
}
const char* host = "esp32";
void initWebServer() {
if (!MDNS.begin(host)) { //http://esp32.local
Serial.println("Error setting up MDNS responder!");
while (1) {
delay(1000);
}
}
Serial.println("mDNS responder started");
/*return index page which is stored in serverIndex */
webserver.on("/", HTTP_GET, []() {
webserver.sendHeader("Connection", "close");
webserver.send(200, "text/html", serverIndex());
});
webserver.on("/JSON", HTTP_GET, []() {
getSettings();
});
/*handling uploading firmware file */
webserver.on("/update", HTTP_POST, []() {
webserver.sendHeader("Connection", "close");
webserver.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
ESP.restart();
}, []() {
HTTPUpload& upload = webserver.upload();
if (upload.status == UPLOAD_FILE_START) {
Serial.printf("Update: %s\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
/* flashing firmware to ESP*/
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { //true to set the size to the current progress
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
} else {
Update.printError(Serial);
}
}
});
webserver.begin();
}
This is testing code, so there might be left-overs from previous tests - FYI.
When loading the website (currently I am using Chrome) it sometimes works, sometimes nothing is loaded (THIS SITE IS NOT WORKING, and then an empty page) and sometimes I get a result like: xVºùÿý?øÿý?;"> which is the only output on the screen.
In detail it shows the following:
<html><head></head><body>xVºùÿý?øÿý?;"><script>var id = 0; [...the rest of the <script> part is loaded properly...]
I just noticed that in front of these strange characters are 364 centered points (·) but I cannot actually copy them, no editor is displaying them besides the Chrome->Inspect->"Sources"-Tab.
So basically the body is broken and these characters appear, they also do not change currently.
Can someone point me into a direction to solve this on my own, so that the website is always correctly loaded or knows what the error is?
The error seems to be on the following line:
const char* r = (std::string("") + “...”).c_str();
You are creating and std::string which allocates the raw c string on the heap. You then get the c representation of the string with .c_str(). The issue is that the string is freed since you have not assigned the string to a variable of type std::string. As a result, you were accessing memory that was not yours. When its memory wasn’t yet reused, it worked, but want is was reused by another program, it failed since you got basically random bytes from memory.
You can solve the issue by adding the following:
auto my_str = std::string("") + “...”;
Because you don’t need the raw pointer.
For the server index function, it should look like:
std::string serverIndex() {
For your init web server function:
webserver.on("/", HTTP_GET, []() {
webserver.sendHeader("Connection", "close");
auto r = serverIndex();
webserver.send(200, "text/html", r.c_str());
});
Disclaimer: this code wasn’t tested as it was only written in the app.
I have an html table on my webpage that is displaying data that I am pulling from a MySql database. When a user clicks on one of the table rows, depending on the data in the row, another div on the page is supposed to update displaying other information. The problem is, when I try to update the inner html of the div from my c# code-behind page, nothing happens. No errors in the dev console, no exceptions thrown, nothing. Why is this happening and how can I fix it? What am I doing wrong?
HTML table data that is being produced through c# code:
protected void PopulateUsers(bool active)
{
ArrayList userList = new ArrayList();
Query query = new Query();
StringBuilder userListHTML2 = new StringBuilder();
string userListHTML = "" +
"<table runat=\"server\" id=\"userListTable\" class=\"table table-striped table-bordered table-hover\">" +
"<thead>" +
"<tr>" +
"<th>User ID</th>" +
"<th>Name</th>" +
"<th>E-Mail</th>" +
"<th>Phone</th>" +
"<th>IsActive</th>" +
"</tr>" +
"</thead>" +
"<tbody>";
string userListHTML3 = "" +
"</tbody>" +
"</table>";
switch (active)
{
case true:
userList = query.GetUserList(true);
break;
case false:
userList = query.GetUserList(false);
break;
}
foreach (User user in userList)
{
userListHTML2.Append(string.Format(#"
<tr>
<td>{0}</td>
<td>{1}</td>
<td>{2}</td>
<td>{3}</td>
<td>{4}</td>
</tr>", user.userID, user.displayName, user.email, user.phone, user.isActive));
}
userListDiv.InnerHtml = userListHTML + userListHTML2 + userListHTML3;
}
jQuery/javascript code capturing click:
function viewUserSpecifics(id) {
var data = id;
var xmlHttpRequest;
xmlHttpRequest = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("testing.XMLHTTP");
if (xmlHttpRequest == null) {
alert("ajax not supported");
return null;
}
xmlHttpRequest.open("GET", "ManagerPopup.aspx?ID=" + data, true);
xmlHttpRequest.send(null);
//document.getElementById('userDataDiv').innerHTML.
}
$(document).ready(function () {
$('#userListTable tbody').on('click', 'tr', function () {
var tableData = $(this).children("td").map(function () {
return $(this).text();
}).get();
//$("#< %= userIDHidden.ClientID %>").val($.trim(tableData[0]));
//alert($.trim(tableData[0]));
viewUserSpecifics($.trim(tableData[0]));
return false;
});
});
Receiving the http request:
protected void Page_Load(object sender, EventArgs e)
{
PopulateUsers(true);
if (Request.QueryString["ID"] != null)
{
string ID = Request.QueryString["ID"];
SpecificUser(ID);
}
}
Method that is supposed to be updating div inner html:
protected void SpecificUser(string id)
{
System.Windows.Forms.MessageBox.Show(id);
Query query = new Query();
User specificUser = new User();
specificUser = query.GetUserSpecifics(Convert.ToInt32(id));
string newFormRow = "<div runat=\"server\" class=\"form-row\">";
string newFormGroup = "<div runat=\"server\" class=\"form-group\">";
string newFormGroupCol = "<div runat=\"server\" class=\"form-group col-md-6\">";
string closeDiv = "</div>";
string UserDataHTML1 = string.Format("" +
newFormRow +
"<label id=\"userIDLabel1\">User ID:</label>" +
"<label id=\"userIDLabel2\">{0}</label>" +
closeDiv +
newFormRow +
newFormGroupCol +
"<label id=\"lblFName\" for=\"txtFName\">First Name: </label>" +
"<input id=\"txtFName\" class=\"form-control\" runat=\"server\" type=\"text\" value={1} />" +
closeDiv +
newFormGroupCol +
"<label id=\"lblLName\" for=\"txtLName\">Last Name: </label>" +
"<input id=\"txtFName\" class=\"form-control\" runat=\"server\" type=\"text\" value={2} />" +
closeDiv +
closeDiv, id, specificUser.fName, specificUser.lName);
userDataDiv.InnerHtml = UserDataHTML1;
}
Any help would be greatly appreciated! Thanks!
To update the html content you should send back a response from your C# route to the client, and update the html part by using jQuery with received data
Initially a table full of values are posted, and a column with the drop button is available using javascript coding. When I click the drop button, a dialog pops up with yes or no, if I click yes, I want that specific order to be transferred to another servlet (/drop). This is the order page (/order) with all the orders. How do I move the order from this page (/order) to the drop page (/drop) and delete that specific order from the /order page?
This is what I did, and I get errors.
(/order)
HttpSession session = request.getSession();
if (session.getAttribute("user_name") != null) {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Payroll", "root", " ");
String userName = (String) session.getAttribute("user_name");
PreparedStatement ps = con.prepareStatement("SELECT * from Payroll.Order order by delDate asc");
ResultSet rs = ps.executeQuery();
out.println("<script type=\"text/javascript\">"
+ "function getConfirmation(){"
+ "var retVal = confirm(\"Add to Drop List?\");"
+ "if( retVal == true ){"
+ "document.location=\"DvDrop\";"
+ "return true;"
+ "}"
+ "else{"
+ "document.location=\"DvOrders\";"
+ "return false;"
+ "}"
+ "}"
+ "</script>" );
out.println(<strong>Welcome " + session.getAttribute("user_name") + "</strong>");
out.println("<br><h2><center><b>Order List</b></center></h2><br><table border=\"1\" style=\"width:100%;border-spacing: 0.5em;text-align: center;\">");
out.println("<tr><td><b>Order ID</b></td><td><b>Ordered Date</b></td><td><b>Ordered Time</b></td><td><b>Total Amount</b></td><td><b>Delivery Date</b></td><td><b>Add to Drop List</b></td></tr></b>");
while (rs.next()) {
out.println("<tr><td>"+ rs.getString(1) + "</td><td>" + rs.getString(2) + "</td><td>" + rs.getTime(3) + "</td><td>" + rs.getDouble(4) + "</td><td>" + rs.getDate(5) + "</td>");
out.println("<td>" + "<input type=\"button\" value=\"Add to Drop\" name=\"AddDrop\" onClick=\"getConfirmation()\">" + "</td></tr>");
}
out.println("</table>");
out.println("</body>");
out.println("</html>");
} else {
response.sendRedirect("login.jsp?id=Your session may be expired. You have to login first");
}
} catch (Exception e) {
out.println(e);
}
}
(/drop)
PrintWriter out = response.getWriter();
try {
// PrintWriter out = response.getWriter() ;
HttpSession session = request.getSession();
if (session.getAttribute("user_name") != null) {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Payroll", "root", " ");
String userName = (String) session.getAttribute("user_name");
String order = (String)session.getAttribute("Orderid");
PreparedStatement ps = con.prepareStatement("delete * from Payroll.Order where Orderid = '" + order + "'");
ResultSet rs = ps.executeQuery();
}
} catch (Exception e) {
out.println(e);
}
I'm assuming that you're getting Java compilation errors in your code. If your code for /order servlet is the same as you've posted here, then, in your code's
out.println(<strong>Welcome " + session.getAttribute("user_name") + "</strong>");
there's an error. You have not defined the string correctly for HTML to be sent to the browser. You need to use a double quotes before the <strong> tag, which seems to be causing the Illegal start of expression error
Try this.
HttpSession session = request.getSession();
if (session.getAttribute("user_name") != null) {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Payroll", "root", " ");
String userName = (String) session.getAttribute("user_name");
PreparedStatement ps = con.prepareStatement("SELECT * from Payroll.Order order by delDate asc");
ResultSet rs = ps.executeQuery();
out.println("<script type=\"text/javascript\">"
+ "function getConfirmation(id){"
+ "var retVal = confirm(\"Add to Drop List?\");"
+ "if( retVal == true ){"
+ "document.location=\"DvDrop?Orderid=" + id + "\";"
+ "return true;"
+ "}"
+ "else{"
+ "document.location=\"DvOrders\";"
+ "return false;"
+ "}"
+ "}"
+ "</script>" );
out.println("<strong>Welcome " + session.getAttribute("user_name") + "</strong>");
out.println("<br><h2><center><b>Order List</b></center></h2><br><table border=\"1\" style=\"width:100%;border-spacing: 0.5em;text-align: center;\">");
out.println("<tr><td><b>Order ID</b></td><td><b>Ordered Date</b></td><td><b>Ordered Time</b></td><td><b>Total Amount</b></td><td><b>Delivery Date</b></td><td><b>Add to Drop List</b></td></tr></b>");
while (rs.next()) {
out.println("<tr><td>"+ rs.getString(1) + "</td><td>" + rs.getString(2) + "</td><td>" + rs.getTime(3) + "</td><td>" + rs.getDouble(4) + "</td><td>" + rs.getDate(5) + "</td>");
out.println("<td>" + "<input type=\"button\" value=\"Add to Drop\" name=\"AddDrop\" onClick=\"getConfirmation(\'" + rs.getString(1) + "\')\" />" + "</td></tr>");
}
out.println("</table>");
out.println("</body>");
out.println("</html>");
} else {
response.sendRedirect("login.jsp?id=Your session may be expired. You have to login first");
}
} catch (Exception e) {
out.println(e);
}
Here, since you need to add a specific item to the drop list, I would suggest creating the button in such a way that when you click it, it sends the ID of the order to be dropped. The proposed change has been made in the above code. What I'm doing there is sending the current order's ID as an argument to the function getConfirmation(). If you want, you can see the final HTML content that is generated using your browser's inspect tool. You'll see that each button calls the same function, but with the corresponding order ID
Also, in your /drop servlet, you're trying to perform data manipulation (insert/update/delete), but you're using the executeQuery() method for it. Instead, try using the executeUpdate(), something like this
PrintWriter out = response.getWriter();
try {
// PrintWriter out = response.getWriter() ;
HttpSession session = request.getSession();
if (session.getAttribute("user_name") != null) {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Payroll", "root", " ");
String userName = (String) session.getAttribute("user_name");
//String order = (String)session.getAttribute("Orderid");
String order = Integer.parseInt(request.getParameter("Orderid"));
PreparedStatement ps = con.prepareStatement("delete * from Payroll.Order where Orderid = '" + order + "'");
int rs = ps.executeUpdate();
}
} catch (Exception e) {
out.println(e);
}
Apart from this, in your JavaScript code, you're assigning a new location to the window, and immediately after that, you're trying to return something. The moment you assign a new location to the document, the current script ends there, and the new web page's script starts executing.
I've proposed some changes to your JavaScript code as well. They're in the first code snippet. Hope this helps!
Cheers!
I need little help.
First, I have page with some values from Database in form, like this:
out.println("<form method=\"post\" action=\"update.jsp?id=" +
rs.getString(1) +"\" onSubmit=\"return editF(this)\" id=\"editDiv"+ rs.getString(1) +"\" >" + SelectCat() +" </form>")
public String SelectCat()
{
String result = "<select name=\"category\" >";
try
{
String request = "SELECT * FROM cat";
Statement st = getConnection().createStatement();
ResultSet rs = st.executeQuery(request);
while (rs.next())
{
result += "<option value=\"" + rs.getString(1) + "\">" + rs.getString(2) + "</option>";
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
result += "</select>";
return result;
}
And my javascript function is
function editF(form)
{
alert("a");
string header = form.header.value;
string text = form.text.value;
string category = form.category.selectedIndex.value;
var e = document.getElementByName("category");
//var category = e.selectedIndex;
form.action = form.action + "&header="+header+"&text="+text+"&categoryID="+category;
return true;
};
But I can't get selected value.
Can you help me?
Thanks!
var category = form.category.options[ form.category.selectedIndex ].value;
Also, javascript is not a strongly-typed language, you cannot define its type when declaring it. Instead, use var.
How can I, on the OnChange event, update data in my database ?
I have a WebMethod, that returns a HTML, so I can't see those elements, so I think he solution will be a javascript function.
A textarea catch the text from the database, if the user alter this, the database field has to be updated.
[WebMethod]
public static object ListAdvertise(string transaction)
{
StringBuilder retorno = new StringBuilder(160000);
Utilidade.QuebraToken tk2 = new Utilidade.QuebraToken();
string Credenciada = tk2.CarregaToken(1, HttpContext.Current.Request.Cookies["token"].Value);
string select3 = "SELECT * FROM San_Imovel WHERE Status_Id = 1 AND Credenciada_Id = " + Credenciada + " AND Transacao_Id IN (" + transacao + ") ORDER BY NomeCidade, NomeBairro, Imovel_Id ASC";
Utilidade.Conexao c3 = new Utilidade.Conexao();
SqlConnection con3 = new SqlConnection(c3.Con);
SqlCommand cmd3 = new SqlCommand(select3, con3);
con3.Open();
SqlDataReader r3 = cmd3.ExecuteReader();
while (r3.Read())
{
Imovel_Id = r3["Imovel_Id"].ToString();
Endereco = r3["Descricao"].ToString() + " " + r3["Logradouro"].ToString() + " " + r3["Numero"].ToString() + "/" + r3["DscComplemento"].ToString() + " " + r3["Complemento"].ToString() + " - " + r3["NomeBairro"].ToString();
TextoAnuncio = r3["TextoAnuncio"].ToString();
if (count % 2 == 0)
{
classe = "EstiloDalinhaGrid";
}
else
{
classe = "EstiloDalinhaAlternativaGrid";
}
retorno.Append("<tr class='" + classe + "'>");
retorno.Append("<td>");
retorno.Append(Imovel_Id);
retorno.Append("</td>");
retorno.Append("<td>");
retorno.Append(Endereco);
retorno.Append("</td>");
retorno.Append("<td>");
retorno.Append("<textarea id='txtArea'>");
retorno.Append(TextoAnuncio);
retorno.Append("</textarea>");
retorno.Append("</td>");
retorno.Append("<td>");
retorno.Append("<input type='checkbox' class='imoveisMarcados' id='" + Imovel_Id + "' />");
retorno.Append("</td>");
retorno.Append("</tr>");
count++;
}
retorno.Append("</table>");
con3.Close();
return new
{
retorno = string.Format(retorno.ToString())
};
i think you have to use Ajax for you to be able to update your data base .
check this link to learn more about ajax with Php (you chose whatever server side langage you'd like)
Ajax with PHP