|
|
|
| Есть следующее!
model.tableModel('submit.php?' + queryString(['FirstName', 'SecondName', 'Salary'],
['FirstName', 'SecondName', 'Salary']));
|
как я понял это и есть отправка с помощью АДЖАКС, правда каким методом хз, но не важно пока!
так же есть такой код, хз что такое
addLoadEvent(function() {
var table = w$('theTable'); //w$ is an alias for UI.Widget.get()
$('buttonAddEmployee').onclick = function() {
//On each click on the add button, add a Employee and repaint
//the table
tableData.push(new Employee(inputFirstName.value, inputSecondName.value,
inputSalary.value));
table.model().changed();
};
$('buttonRemoveEmployee').onclick = function() {
if (table.selectedRow >= 0) {
tableData.splice(table.selectedRow, 1);
table.model().changed();
} else {
alert("You must select a employee first");
}
};
});
</script>
|
как я понял кнопки вот!
//We are going to (ab)use the footers, puting some DOM there.
var inputFirstName = INPUT({'type': 'text'});
var inputSecondName = INPUT({'type': 'text'});
var inputSalary = INPUT({'type': 'text'});
|
сами данные вот но они не из базы
//Our initial data
var tableData = [
new Employee('John', 'Johnson', 1000),
new Employee('Peter', 'Peterson', 950),
new Employee('Steven', 'Stevenson', 1400),
new Employee('Я', 'Я', 9999),
new Employee('Jack', 'Jackson', 500)
];
|
пока мне вытаскивать из базы не надо, мне как то нужно разобратся как писать в базу :(
весь код вот
<html>
<head>
<link rel="stylesheet" href="ui4web-0.5.3/styles/uidefault.css">
<style>
.uitable table {cursor: pointer;}
.uitable table {width: 100%;}
.uitable table th {width: 33%;}
</style>
<script src="ui4web-0.5.3/MochiKit.js"></script>
<script src="ui4web-0.5.3/ui.js"></script>
</head>
<body>
<script>
//A simple class
function Employee(firstName, secondName, salary)
{
this.firstName = firstName;
this.secondName = secondName;
this.salary = salary;
}
//Our initial data
var tableData = [
new Employee('John', 'Johnson', 1000),
new Employee('Peter', 'Peterson', 950),
new Employee('Steven', 'Stevenson', 1400),
new Employee('Я', 'Я', 9999),
new Employee('Jack', 'Jackson', 500)
];
//We are going to (ab)use the footers, puting some DOM there.
var inputFirstName = INPUT({'type': 'text'});
var inputSecondName = INPUT({'type': 'text'});
var inputSalary = INPUT({'type': 'text'});
//Let's make our model
var tableModel = new UI.ArrayTableModel(tableData,
['firstName', 'secondName', 'salary'],
['string', 'string', 'numeric'],
['Fist Name', 'Second Name', 'Salary'],
[inputFirstName, inputSecondName, inputSalary]);
model.tableModel('submit.php?' + queryString(['FirstName', 'SecondName', 'Salary'],
['FirstName', 'SecondName', 'Salary']));
</script>
<div id="theTable" class="uitable" ui:model="tableModel"></div>
<input type="button" id="buttonAddEmployee" value="Add Employee">
<input type="button" id="buttonRemoveEmployee" value="Remove Employee">
<script>
model.tableModel('submit.php?' + queryString(['FirstName', 'SecondName', 'Salary'],
['FirstName', 'SecondName', 'Salary']));
addLoadEvent(function() {
var table = w$('theTable'); //w$ is an alias for UI.Widget.get()
$('buttonAddEmployee').onclick = function() {
//On each click on the add button, add a Employee and repaint
//the table
tableData.push(new Employee(inputFirstName.value, inputSecondName.value,
inputSalary.value));
table.model().changed();
};
$('buttonRemoveEmployee').onclick = function() {
if (table.selectedRow >= 0) {
tableData.splice(table.selectedRow, 1);
table.model().changed();
} else {
alert("You must select a employee first");
}
};
});
</script>
</body>
</html>
|
пару раз один код повторяется но не важно, если работали с библиотекой или прсот опонимаете - если не трудно помогите разобратся :(
субмит такой, что бы наверника :)
<?php
include "config.php";
$name1 = $_POST["FirstName"];
$name2 = $_POST["SecondName"];
$name3 = $_POST["Salary"];
$name1 = $_POST["FirstName"];
$name2 = $_POST["SecondName"];
$name3 = $_POST["Salary"];
$name11 = $_POST["FirstName"];
$name22 = $_POST["SecondName"];
$name33 = $_POST["Salary"];
$name11 = $_GET["FirstName"];
$name22 = $_GET["SecondName"];
$name33 = $_GET["Salary"];
$name111 = $_POST["FirstName"];
$name222 = $_POST["SecondName"];
$name333 = $_POST["Salary"];
$name111 = $_GET["FirstName"];
$name222 = $_GET["SecondName"];
$name333 = $_GET["Salary"];
@mysql_query("INSERT INTO a VALUES ('', '$name1', '$name2', '$name3')"); //Пишем сам домен
@mysql_query("INSERT INTO a VALUES ('', '$name11', '$name22', '$name33')"); //Пишем сам домен
@mysql_query("INSERT INTO a VALUES ('', '$name111', '$name222', '$name333')"); //Пишем сам домен
?>
|
| |
|
|
|
|
|
|
|
для: Panker
(13.08.2007 в 19:39)
| | Брррр, хотя бы скажите как с помощью аякса прсото отправить данные, если дело в деньгах то не проблема, цену назовите | |
|
|
|
|
|
|
|
для: Panker
(13.08.2007 в 19:39)
| | Код лучше в аттач кидать а не весь в форум совать | |
|
|
|
|