I am trying to send request data using ajax to my backend server consist of python & django
Python Code
views.py
def JSON_Sample(request):
response_data = {}
response_data['result'] = "Success"
response_data['message'] = "AJAX Worked"
return JsonResponse(response_data)
AJAX request
AJAX request
$.ajax({
url:"http://localhost:8000/login/json",
dataType:"jsonp",
success:function(response){
alert("finaly sucess");
}
});
Error in this is cross origin request blocked. I am newbie in it please help me out what should i do in my code ?