Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

convert can.Observe to plain object

$
0
0
in JMVC3.3/canJS attributes set by attr() are no longer simple objects, but can.Observe objects. Whenever I try to use these data in an ajax request buildParams fails.

example:

  1. var params = can.Observe( {
  2.       extent : {
  3.             east: 5.9700203118605,
  4.             north: 52.211401605631,
  5.             south: 52.211118448568,
  6.             north: 5.9684737677777
  7.       }
  8. });

  9. $.ajax( {
  10.       type: 'GET',
  11.       url: 'http://bag.dotkadata.com/Bag/Extent',
  12.       data: params,       
  13.       dataType: 'json'
  14.  }).done( function( result ) {
  15.       console.log( result );
  16. });
See it at work: http://jsfiddle.net/nvnYU/7/

So my question is: How can I get a plain object again from an observable?

Viewing all articles
Browse latest Browse all 3491

Trending Articles