Skip to content

Instantly share code, notes, and snippets.

@pwmckenna
Created February 26, 2013 21:46
Show Gist options
  • Save pwmckenna/5042530 to your computer and use it in GitHub Desktop.
Save pwmckenna/5042530 to your computer and use it in GitHub Desktop.
an's frontend guild code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>lazy CPA config tool</title>
<SCRIPT language="javascript">
function toggle_enabled(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for (var i = 0; i < rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if (null != chkbox && true == chkbox.checked) {
var str = row.cells[3].innerHTML;
if (str == "yes") {
row.cells[3].innerHTML = "no";
console.log("todo toggle data from yes to no");
}
else
{
row.cells[3].innerHTML = "yes";
console.log("todo toggle data from no to yes");
}
}
}
} catch (e) {
alert(e);
}
}
</SCRIPT>
</head>
<br>Ads<br>
<table border="1" id="dataTable">
<tr><td>select for action</td><td>ad id</td><td>event id's</td><td>is enabled?</td></tr>
{% for ad in ads %}
{% block ad %}
<tr>
<td><input type="checkbox" </td>
<td>{{ad['ad_id']}}</td>
<td>{{ad['event_ids']}}</td>
{% if ad['enabled'] %}
<td>yes</td>
{% else %}
<td>no</td>
{% end %}
</tr>
{% end %}
{% end %}
</table>
<INPUT type="button" value="toggle enabled/disabled" onclick="toggle_enabled('dataTable')" />
</body>
</html>
@pwmckenna
Copy link
Author

Should probably just post, but you could do something like this

$.ajax({
    url: 'http://intranet.bit/endpointname',
    type: 'POST',
    data: {
        ad_id: true,  //for example
        event_ids: true,
        enabled: false
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment