myArray.sort(function(a,b) {return a-b;});
$('#confirmForm').on('click', function (event) {
$.ajax({
url: '/confirm',
method: 'post',
dataType: 'json',
success: function (data) {
console.log(data);
}
});
});
<?php
session_start();
require_once '/vendor/autoload.php';
$router = new AltoRouter();
$router->map('GET|POST', '/confirm', 'Main::index');
if ($match = $router->match()) {
$path = explode('::', $match['target']);
$controllerName = 'Controller\\' . $path[0];
$controller = new $controllerName;
call_user_func_array([$controller, $path[1]], $match['params']);
} else {
header('Location: /404');
}
<?php
class Main()
{
public function index()
{
$service = new MainService();
$service->saveForm();
json_encode([
'success' => true,
'message' => 'Форма успешно сохранена'
], JSON_UNESCAPED_UNICODE);
}
}
function sendPostToUrl(url, post) {
var form = $('<form/>', {
action: url,
method: 'post',
target: '_blank',
style: {
display: 'none'
}
});
for (key in post) {
if ('message' === key) {
for (i in post[key]) {
form.append($('<input/>', {
type: 'hidden',
name: 'message[]',
value: post[key][i]
}));
}
} else {
form.append($('<input/>', {
type: 'hidden',
name: key,
value: post[key]
}));
}
}
form.submit();
}
$('#learn-more').on('click', function (event) {
event.preventDefault();
sendPostToUrl($(this).attr('href'), data);
});
$(function() {
var modal = $('#your-modal').remodal();
modal.open();
});
$(#modalWindow).dialog();
function foo() {
return $.ajax({...});
}
function bar() {
foo().then( function(data) {
//тут разбираем json и собираем разметку таблицы в банальную строку
$(#modalWindow).html( table );
$(#modalWindow).dialog( 'open' );
} );
}
function load() {
var key;
$.ajax({
url: 'engine/loadC.php',
data: {'filename': 'key.txt'},
async: false,
type: 'post',
dataType: 'json',
success: function(data) {
key = json.parse(data);
}
});
return key;
}
function progress() {
load();
alert(window.key);
}
{"files":[{
"name":"Penguins (3).jpg",
"size":777835,
"type":"image/jpeg",
"url":"http://localhost/jQuery-File-Upload-master/server/php/files/Penguins%20%283%29.jpg",
"thumbnailUrl":"http://localhost/jQuery-File-Upload-master/server/php/files/thumbnailPenguins%20%283%29.jpg",
"deleteUrl":"http://localhost/jQuery-File-Upload-master/server/php/?file=Penguins%20%283%29.jpg",
"deleteType":"DELETE"
}]
}
{"files":[{
"name":"img30.jpg",
"size":0,
"type":"multipart/form-data;
boundary=---------------------------184031683226945",
"error":"File upload aborted",
"deleteUrl":"http://art-surf.ru/jQuery-File-Upload-9.5.7/server/php/?file=img30.jpg",
"deleteType":"DELETE"
}]
}
<input type="file">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SSI</title>
</head>
<body>
<!--#include virtual="header.html"-->
<p>содержимое INDEX</p>
</body>
</html>
<p>содержимое HEAD</p>