M
M
Mykola Dudyak2020-06-01 12:47:14
JavaScript
Mykola Dudyak, 2020-06-01 12:47:14

Probe with the code please getjson is not fixed?

Help with the code not to enter lines of text,
I need to enter lines:

5ed3b8844c059522707777.jpeg

the code leaves but does not return
5ed4d0a419706658901224.jpeg

$(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(' '));
    });
  });
});


There is no #btn_submit button on the site. I have it in the program

5ed3ed4cec2c6548120474.jpeg

<!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>


manifest code
{
  "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 question

Ask a Question

731 491 924 answers to any question