# (developers) Good UI progress! Can someone help me with my AJAX?

**URL:** <https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899>\
**Category:** Ansible Project\
**Created:** [September 16, 2012, 3:28pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899 "2012-09-16T15:28:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 16, 2012, 3:28pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899/1 "2012-09-16T15:28:28Z")

</div>

Hi all,

Time to help a bit on the UI project!

As I've mentioned, I'm not a Javascript/UI expert. For starters,  
I've got a very basic modal login dialog started here (loving  
JQuery+Bootstrap so far), and the intent is to hit "/api" to figure  
out if the login is successful or not and to dismiss the dialog. To  
do this, I'm trying to use the jQuery .ajax.

[https://github.com/ansible/ansible-commander/blob/master/ui/index.html](https://github.com/ansible/ansible-commander/blob/master/ui/index.html)

[https://github.com/ansible/ansible-commander/blob/master/ui/commander.js](https://github.com/ansible/ansible-commander/blob/master/ui/commander.js)

See the function "api\_call" which I'm trying to define and debug.  
It's calling the error callback with a code of "0" and not telling me  
very much more about what I'm doing wrong.

Can someone help me out here and see why the API is not logging in  
successfully? It does not seem to be hitting the REST layer and  
Firebug is of limited usefulness. I have added some calls in the API  
to log to syslog when things are hit, though logging is not showing up  
yet.

I figure once we get past this, and also have some basic REST examples  
of some POSTs and DELETEs as well, it will be VERY easy to go to town  
on this and implement all the basic object editing.

The idea is it's going to be a one page interface -- the modal goes  
away after login, and you see the main commander interface, and there  
are different panels/tabs/whatever for working with users, inventory,  
and so on.

Anyway, help on getting this first API request working would be very welcome.

Thanks!

--Michael

---

<div class="post-metadata">

**Author:** ![Stephen\_Major](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Stephen\_Major](https://forum.ansible.com/u/Stephen_Major)\
**Post date:** [September 16, 2012, 4:55pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899/2 "2012-09-16T16:55:01Z")

</div>

Is it decided on bootstrap and jquery or might it be possible to influence the use of extjs this early on??

Because of extjs using panels it would make it easy for the.codebase to be reusable and pluggable with other projects like the graphite ui

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 16, 2012, 5:14pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899/3 "2012-09-16T17:14:04Z")

</div>

It's decided.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 16, 2012, 5:37pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899/4 "2012-09-16T17:37:36Z")

</div>

FWIW, figured out this particular problem -- attempting to use Cross  
Site Scripting as a feature is apparently frowned upon 🙂

---

<div class="post-metadata">

**Author:** ![Stephen\_Major](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Stephen\_Major](https://forum.ansible.com/u/Stephen_Major)\
**Post date:** [September 16, 2012, 5:46pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899/5 "2012-09-16T17:46:23Z")

</div>

Checkout jsonp for cross site

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 16, 2012, 6:15pm UTC](https://forum.ansible.com/t/developers-good-ui-progress-can-someone-help-me-with-my-ajax/11899/6 "2012-09-16T18:15:11Z")

</div>

What I ended up doing was telling flask to serve the static content,  
which was pretty straight forward.

Login now works very well.

I'll probably get the various other resources started in the next few  
days, then, like I said, the UI is subject to as many improvements as  
people can think of once we get the basics down.

(I have some minor backend things to do also like limit what non-admin  
users can do to other users, but this is all listed in the TODO.md  
file)

--Michael
