Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

How to use AJAX-FORMS to POST to server with polymer

Hi everyone,

I'm REALLY hoping someone here can help me as i've been trying this for almost a week now and i'm not sure what to do.

I have watched the AJAX basics course and I am still unable to get this working.

I am trying to use Polymer's TOPEKA (https://github.com/polymer/topeka) and AJAX-FORMS ( https://github.com/rnicholus/ajax-form ) to POST to post the user inputs to my server.

I am only trying to post the name and email so when the user enters them they are saved.

Here is my HTML

<div class="main" flex layout vertical cross-fade-delayed?="{{parentElement.lastSelected === 'splash'}}"> <div class="card {{ {wide: wide} | tokenList }}" flex layout vertical slide-up-offscreen?="{{parentElement.selected === 'profile'}}" cross-fade="{{!wide && parentElement.selected !== 'profile'}}"> <div layout vertical flex cross-fade-delayed?="{{parentElement.lastSelected !== 'splash' && wide}}" on-keypress="{{ keypressAction }}"> <form is="ajax-form" action="savesjson.php" method="post"> <div class="indent" layout vertical> <div class="header">{{userDefaults ? 'Your Profile' : 'Welcome'}}</div> <paper-input label="Name" name="first_name" id="first"></paper-input> <paper-input label="Email Address" name="email_address" id="last" maxlength="1"></paper-input> </div> <div id="avatarList" flex> <core-selector selected="{{selectedAvatar}}" layout horizontal justified wrap>

      </core-selector>
    </div>
    <div horizontal center layout>
      <paper-button on-tap="{{handleLogout}}" hidden?="{{!user}}">Sign Out</paper-button>
      <div flex></div>
      <paper-fab id="check" icon="check" showing?="{{$.first.value.length && $.last.value.length && selectedAvatar !== undefined}}" on-tap="{{handleLogin}}"><button type="submit" class="submit"></button></paper-fab>
    </div>
    </form>
  </div>
</div>

</div>

</template>

I'm not sure what is required for the javascript. If anyone can tell me what to do, I am forever grateful!!