Previously working emberjs1.0-pre form on jsfiddle returns "error": "Please use POST request"
Posted
by
brg
on Stack Overflow
See other posts from Stack Overflow
or by brg
Published on 2012-08-27T23:30:53Z
Indexed on
2012/08/28
15:38 UTC
Read the original article
Hit count: 446
ember.js
This code ** http://jsfiddle.net/wagenet/ACzaJ/8/ ** was working a few days ago, when i returned to it today, it throws {"error": "Please use POST request"}, when i click add button Also the jsfiddle editor.js always throws exception on this line: function stop(){cc = stop; throw StopIteration;}; Does anyone knows the cause of this issue.
Many thanks
Update 1
Based on @Peter Wagenet's suggestions below, the form now logs entries or inputs to the console but it doesn't display on the result section of jsfiddle instead what is displayed on jsfiddle result section or page is still this error {"error": "Please use POST request"}
** http://jsfiddle.net/ACzaJ/18/
Update 2
In this fiddle, http://jsfiddle.net/ACzaJ/19/, i have successfully eliminated this error {"error": "Please use POST request"} by adding event.preventDefault(); to the submit action in Todos.TodoFormView. That allows us to use arbitrary view methods as action handlers.
The existing issue is that the input to the form, only displays on the console and not on jsfiddle result section, though no error displays on the result section, there is a new error appearing in the console of the updated fiddle:
Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM.
Finally solved
I needed to comment out App.initialize() for it to work as expected. This the working fiddle ** http://jsfiddle.net/ACzaJ/20/.
I don't know why that is so, but my guess is that, App.initialize works with other parts like the router for routing, ApplicationController and ApplicationView with {{outlet}} in the handlebars, which i didn't need for this fiddle.
Finally Finally and completely solved
This ** http://jsfiddle.net/tQWn8/ works with App.initialize. But you have to declare all those components above and pass the router to App.initialize, like this App..initialize(router). If you don't do this, then you will get the old error Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM.
© Stack Overflow or respective owner