python - jQuery.ajax success callback not called although Pyramid did return response -



python - jQuery.ajax success callback not called although Pyramid did return response -

i have simple jquery ajax post pyramid webapp.

ajax call:

$.ajax({ type: 'post', url: 'http://localhost:6543/test', datatype: 'json', data: json.stringify({"username":"demo","email":"demo@something.com","password":"1234"}), success: function (response) { alert(response); }, error: function (msg) { alert("error"); } });

pyramid route:

config.add_route('test', 'test') config.add_view('tagzu.views.test', route_name='test', renderer='json')

pyramid view:

def test(request): homecoming {'content':'hello!'}

now when phone call service, sending this

request:

post /test http/1.1 host: localhost:6543 user-agent: mozilla/5.0 (macintosh; intel mac os x 10.6; rv:5.0) gecko/20100101 firefox/5.0 accept: application/json, text/javascript, */*; q=0.01 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 content-type: application/x-www-form-urlencoded; charset=utf-8 content-length: 66 origin: null pragma: no-cache cache-control: no-cache {"username":"demo","email":"demo@something.com","password":"1234"}

and reponse:

http/1.0 200 ok server: pastewsgiserver/0.5 python/2.7.1 date: fri, 08 jul 2011 01:42:33 gmt content-type: application/json; charset=utf-8 content-length: 21 {"content": "hello!"} problem is:

the ajax success handler never been called. error handler keeps firing error msg.statustext = 'error'

please allow me know if missing something. thanks

for encountering same issue me, ie. not having plenty sleep!!

for sake of god create sure html on same server, happens because of calling across domains of course, html jquery local file, service served on localhost.

so server rejecting query without error details point me in right direction.

cross-domain lastly thing have thought of, beingness focused on pyramid, thought might doing funny. funny me, wasting much time.

python jquery pyramid

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -