function sendAjaxForm(result_form, ajax_form, url) {
let data = {
name: "misha",
age: 20,
city: "Msc"
};
...
contentType: "application/json; charset=utf-8",
dataType:"json",
data: JSON.stringify(data),
xhrFields: {
withCredentials: false
}
success: function(response) {
console.log(response);
$('#result_form').html(response);
},
...
let data = {};
data = JSON.stringify($('form').serializeObject());
$(function() {
$('#toggle-gender').bootstrapToggle({
on: 'Male',
off: 'Female'
});
})
$('#toggle-gender').change(function() {
var isChecked = $(this).is(":checked");
var the_value = isChecked ? 'Male' : 'Female';
$(this).val(the_value);
})
if ($('#toggle-gender').is(":checked") == false) {
$('#toggle-gender').val('Female');
}
void plotLineAA(int x0, int y0, int x1, int y1)
{
int dx = abs(x1 - x0), sx = x0<x1 ? 1 : -1;
int dy = abs(y1 - y0), sy = y0<y1 ? 1 : -1;
int err = dx - dy, e2, x2; /* error value e_xy */
int ed = dx + dy == 0 ? 1 : sqrt((float)dx*dx + (float)dy*dy);
for (; ; ) { /* pixel loop */
setPixelAA(x0, y0, 255 * abs(err - dx + dy) / ed);
e2 = err; x2 = x0;
if (2 * e2 >= -dx) { /* x step */
if (x0 == x1) break;
if (e2 + dy < ed) setPixelAA(x0, y0 + sy, 255 * (e2 + dy) / ed);
err -= dy; x0 += sx;
}
if (2 * e2 <= dy) { /* y step */
if (y0 == y1) break;
if (dx - e2 < ed) setPixelAA(x2 + sx, y0, 255 * (dx - e2) / ed);
err += dx; y0 += sy;
}
}
}
void setPixelAA(int x, int y, double alpha)
{
int a = 1 - alpha / 255;
}
// функция рисования "черной" точки
void DrawDarkPoint(int **array, bool steep, int x, int y, float c)
{
if (!steep)
{
int color = array[x][y];
color *= (1 - c);
array[x][y] = color;
}
else
{
int color = array[y][x];
color *= (1 - c);
array[y][x] = color;
}
}
void WuLine(int** array, int x0, int y0, int x1, int y1)
{
int steep = abs(y1 - y0) > abs(x1 - x0);
if (steep)
{
swap(x0, y0);
swap(x1, y1);
}
if (x0 > x1)
{
swap(x0, x1);
swap(y0, y1);
}
DrawDarkPoint(array, steep, x0, y0, 1);
DrawDarkPoint(array, steep, x1, y1, 1);
float dx = x1 - x0;
float dy = y1 - y0;
float gradient = dy / dx;
float y = y0 + gradient;
for (int x = x0 + 1; x <= x1 - 1; x++)
{
DrawDarkPoint(array, steep, x, (int)y, 1 - (y - (int)y));
DrawDarkPoint(array, steep, x, (int)y + 1, y - (int)y);
y += gradient;
}
}