Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Load function returns 405 Method not Allowed

I am dealing with a web app based on Google App Engine (Python). I am trying to update a div from a Polymer (HTML) element. The Div I need to update is actually the element's container. To this end, from the element's javascript snippet I am trying to get the div object through Jquery and invoking its load method like

 $('#myContainerId').load('/myQueryUrl?id=123123123');

The problem is that I get 405 Method Not Allowed

UPDATE

the url is bound to a Python webapp.RequestHandler through the app's yaml file which implements the get method, makes a query to the ndb and render a Jinja2 template.

UPDATE 2

The error in the consol log, when expanded, says:

k.cors.a.crossDomain.send 
n.extend.ajax 
n.fn.load 
(anonymous function) 
j 
k.fireWith 
x 
(anonymous function)

It says there is a cross domain although the domains are actually the same

like image 689
lowcoupling Avatar asked Dec 07 '25 19:12

lowcoupling


1 Answers

Use $.ajax() instead of $.load() to control the request/response explicitly. This may do the trick (you may need to adjust the params):

$('#myContainerId').ajax({
  crossDomain: FALSE,
  type: "POST", // || GET || PUT || DELETE
  url: '/myQueryUrl?id=123123123'
});
like image 80
adam_bear Avatar answered Dec 10 '25 09:12

adam_bear