To pass a value input in php?

Good day, comrades.
The next question.
there
You need to pass the entered value without clicking submit
Ie entered in the data input machine to throw in a php variable
March 19th 20 at 09:03
2 answers
March 19th 20 at 09:05
the loss of focus of input + ajax
when you input the input. - hilario_Tillman commented on March 19th 20 at 09:08
@hilario_Tillman,

$('input').blur(function(){
$.ajax({
 url: 'file.php',
 type: 'POST',
 data: {
 'field': $(this).val(),
},
});
});
- vern_Grimes commented on March 19th 20 at 09:11
@hilario_Tillman, I'll write you an example earlier - vern_Grimes commented on March 19th 20 at 09:14
@vern_Grimeswho me? I mean, that blur is the same button, it won't work, if something to print and take your hands away from the computer) - hilario_Tillman commented on March 19th 20 at 09:17
@vern_Grimes, but so would work:
$('input').on('input', function(){
$.ajax({
 url: 'file.php',
 type: 'POST',
 data: {
 'field': $(this).val(),
},
});
});
- hilario_Tillman commented on March 19th 20 at 09:20
@hilario_Tillman,

blur - this is the same button,

no, it's a loss of focus - vern_Grimes commented on March 19th 20 at 09:23
Then try these events

.keydown()
Event is fired when pressing a key, before the keypress event.

.keypress()
Event is fired when you press a key, until then, until you release the key.

.keyup()
Event is fired when you release the button. - vern_Grimes commented on March 19th 20 at 09:26
Thanks guys.
Che still stumped me.
I was trying to make.
You need to:
When you enter in the input url, a request is sent to VK API, from the API response I deduce avatar

Google clambered, example implementations, at least similar, something not found - Cydney94 commented on March 19th 20 at 09:29
@vern_Grimes, and you can lose focus without pressing the extra button? - hilario_Tillman commented on March 19th 20 at 09:32
March 19th 20 at 09:07

Find more questions by tags JavaScriptPHP