Answer the question
In order to leave comments, you need to log in
Probe with the code please getjson is not fixed?
Help with the code not to enter lines of text,
I need to enter lines:
the code leaves but does not return
$(document).ready(function() {
$('#btn_submit').click(function(e) {
e.preventDefault();
var input = $('#input').val();
$.getJSON("http://sum.in.ua/?swrd=", {
lang: ((/[а-я]/i.test(input)) ? 'ru-en' : 'en-ru'),
text: input
}, function(data) {
var resultTextArr = [];
for (var i in data.text) {
resultTextArr.push(data.text[i]);
}
$('#result').text(resultTextArr.join(' '));
});
});
});
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script src="popup.js"></script>
<title></title>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<textarea cols=20 id="input"></textarea>
<input id="btn_submit" type="submit"><br>
</header>
<article>
<div id="result"></div> <!---->
</article>
<footer>
©
<span>2020</span>
Good Word Guide
</footer>
</div>
</body>
</html>
{
"name": "Електронний Словник",
"version": "1.0",
"description": "Помічник с текстом",
"permissions": ["tabs", "<all_urls>","http://sum.in.ua/*"],
"browser_action": {
"default_title": "Открыть переводчик",
"default_popup": "popup.html"
},
"manifest_version": 2
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question