JavaScript
48
Вклад в тег
'one two three'.split(' ').reverse().join(' ')
<ul>
<li>Один Два Три</li>
<li>Четыре</li>
<li>1234567890</li>
</ul>
var list = $('ul li')
list.each(function(index, item)
{
currentItemText = $(item).html();
$('li:eq(' + index + ')').html(currentItemText.split('').reverse().join(''));
// console.log($(item).html());
});
var someObj = {a:1,b:2};
var xhr = new XMLHttpRequest();
xhr.open('POST', 'scratch.php');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('param=' + JSON.stringify(someObj));
xhr.onreadystatechange = function()
{
if (this.readyState == 4)
{
if (this.status == 200)
{
console.log(xhr.responseText);
}
else
{
console.log('ajax error');
}
}
};
$param = json_decode($_REQUEST["param"]);
$result = "Результат: a = ".$param->a."; b = ".$param->b;
die($result);
var testStr = "Lorem ipsum 'vendor/js/srcipt.js' dolor sit amet, 'lib/ls/jquery/jquery.min.js' consectetur 'img/pict.jpg' adipisicing 'vendor/style/some-style.min.css' 'vendor/style/some-style.less' или 'vendor/img/bla.png' elit. Adipisci, tenetur?";
var reqExpWrapper = new RegExp('(?:vendor/)((?:.*?)\\.(?:css|js))\'', 'g');
var matches = new Array();
while(match = reqExpWrapper.exec(testStr))
{
matches.push(match[1]);
}
console.log(matches);