10

I am making a chrome extension to send a post request to a certain URL, and I don't care about the response. When I run my javascript in my browser it works fine but if I put in the chrome extension, it doesn't even send.Here is my popup.html file

<!doctype html>
<html>
    <head>
        <title>BCA Auto Login</title>
        <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
        <style type="text/css">
        body{
            background-color: #2c3e50;
        }
        label{
            color:#f1c40f;
        }
        </style>
    </head>
    <body>
        <form method="POST" id="form">
            <label>Enter username
                <input id="username">
            </label>
            <br>
            <label>Enter password
                <input id="password" type="password">
            </label>
            <br>
            <button type="submit">Submit</button>
        </form>
    <script type="text/javascript">
        $('#form').submit(function (event) {
            event.preventDefault();
            $.ajax({
                type : 'POST',
                url : 'https://testurl.com/',
                data : {
                    reqFrom: 'perfigo_simple_login.jsp',
                    uri: 'https://ccahack.bergen.org/',
                    cm: 'ws32vklm',
                    userip: '168.229.105.180',
                    os: 'MAC_OSX',
                    index: '4',
                    username: 'username',
                    password: 'password',
                    provider: 'BCA',
                    login_submt: 'Continue'
                }
            }); 
        });
    </script>
    </body>
</html>

And here is my mainfest.json:

{
  "manifest_version": 2,

  "name": "Auto Login",
  "description": "This extension automatically signs you into the wifi",
  "version": "1.0",

  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [
    "cookies",
    "http://*/*"
    "https://*/*"
  ]
}
user1457388
  • 211
  • 2
  • 11
  • [Inspect the popup](https://developer.chrome.com/extensions/tut_debugging.html#inspect-popup) and find what errors your script is getting. – abraham Nov 22 '13 at 20:44
  • 2
    @abraham Your "duplicate" is misidentified. In this question, the issue is caused by inline JavaScript. Even if inline JavaScript is allowed, domready event is not needed because the ` – Rob W Nov 23 '13 at 09:29

0 Answers0