Hey all,

I am using devise. While the data successfully updates to database, it
still reports back as an error, and the below error function is
executed:

          var options = {
            type: 'POST',
            url: "/user",
            dataType: 'json',
            data: $('#dialog-form form:first').serialize(),
            error: function(xhr, textStatus, errorThrown) {
              alert('An error occurred! ' + errorThrown);
            },
            success: function(data, textStatus) {
              $('body').append( data );
            }
          };
          $.ajax( options );


I get a popup that says:

The page at http://localhost:3000 says:An error occurred! Invalid JSON:
<!-- /application.html -->
<!DOCTYPE html>
<html>
  <head>
    <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
    <meta content='Lose weight and diet' name='description'>
    <meta content='Diet, Lose Weight, name='keywords'>
    <title>Diet | IMRS</title>
    <link href='/images/favicon.png' rel='shortcut icon'
type='image/x-icon'>
    <link href='/lab/rss_2.0' rel='alternate' title='Diet RSS Feed'
type='application/rss+xml'>
    <link href='/lab/atom' rel='alternate' title='Diet Atom Feed'
type='application/atom+xml'>
    <!-- <link rel="stylesheet" type="text/css" href="/css/basic.css" />
-->
    <link href="/stylesheets/basic.css?1299515867" media="screen"
rel="stylesheet" type="text/css" />
    <link href="/stylesheets/blog_kit.css?1299515867" media="screen"
rel="stylesheet" type="text/css" />
    <link href="/stylesheets/jquery-ui-1.8.10.custom.css?1299691709"
media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/screen.css?1299691709" media="screen"
rel="stylesheet" type="text/css" />
  </head>
  <body id='home'>
    <div id='contain'>
      <div id='page'>
        <!-- /home.html - home page for the application -->
        <!-- /this is placed within the page div from the
application.html.haml -->
        <div id='headerHome'>
          <div class='headline' id='headline'>
            <div id='loginbox'>
              <ul class='hmenu'>
                <li>
                  <button id="create-user" type="button" name="signup"
value="signup">Sign up</button>
                </li>
                <li>
                  <button id="sign-in" type="button" name="signin"
value="signin">Sign in</button>
                </li>
              </ul>
            </div>
//and it goes on to render the entire markup of page

Even when I remove the datatype here:
            dataType: 'json'

It still gives same error report.

Any idea as to whether this is devise related?

Thanks for response.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to