Saturday, 15 August 2015

jquery - No response from url when requesting from javascript -


I am trying to use ipinfo api in my django app.

My JS code -

  var button = document.getElementById ('login_button'); Var user_location = document.getElementById ('user_location'); button. Click on = function () {get_location (); Form.submit (); } Function get_location () {warning ('inside'); $ .get ('http://ipinfo.io', function (response) {warning ('response'); user_location.value = response.loc; console.log (response.loc); warning (response.loc); }, 'Jsonp'); }  

My html code (contextual) -

  & lt; Div class = "row" & gt; & Lt; Form id = "form" method = "post" class = "form" & gt; {% Csrf_token%} & lt; Input type = "hidden" id = "user_location" name = "user_location" /> & Lt; / Form & gt; & Lt; / Div & gt; & Lt; Div class = "row" & gt; & Lt; Button type = "button" id = "login_button" name = "confirm_login" class = "tooltip-testing btn btn-sm btn-success" title = "click to log in" & gt; Login & lt; / Button & gt; & Lt; / Div & gt;  

and my views.py relevant codes -

  o = online_states (user name = u.username, location = post ['user_location' ]) Devices_no = 1 o.save ()  

My problem starts with JS file It is 'inside' alert, but this alerts it to 'feedback' and neither does my There is something in the browser console and there is no warning response. Loc

Where am I wrong .. ?? <

Please help me.

Note: My Internet proxy is behind

Thanks in advance.

Mostly, you are killing a "cross-oral problem" for more discussion.


No comments:

Post a Comment