[jbosstools-issues] [JBoss JIRA] (JBIDE-18312) CordovaSim struggles with POST

Ilya Buziuk (JIRA) issues at jboss.org
Tue Oct 7 11:10:12 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-18312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009375#comment-13009375 ] 

Ilya Buziuk commented on JBIDE-18312:
-------------------------------------

< only issue left is that new contact is ot displayed within Enterprise Contact list I have to refresh manually index.html page and then new added contact is displayed
[~vpakan], I think this is expected behavior. I forgot to tell you that I have slightly update the code. It works in my demo cause I added the *$.getJSON* call to the *.done* function: 
{code}
var jqxhr = $.ajax({
    url: "http://crudcontacts-html5.rhcloud.com/rest/members",
    contentType: "application/json",
    dataType: "json",
    data: newContactAsJSON,
    type: "POST"
}).done(function(data, textStatus, jqXHR) {
    console.log(" POST Success");
    // note: need to refresh the data
    $.mobile.changePage("#page-1");
    $.getJSON("http://crudcontacts-html5.rhcloud.com/rest/members", function(data) {
        $("#contacts").empty();
        var items = [];
        $.each(data, function(key, val) {
            console.log("item: " + key + " " + val.firstName + " " + val.lastName);
            items.push("<li><a href='#" + key + "'>" + val.firstName + " " + val.lastName + "</a></li>");
        });
        $("#contacts").append(items);
        $("#contacts").listview("refresh");
    });
    $("#contacts").listview("refresh");
}).fail(function(jqXHR, textStatus, errorThrown) {
    console.log(textStatus + ": " + errorThrown);
});
{code}
AFAIK if you copy/paste the snippet it will start working

> CordovaSim struggles with POST
> ------------------------------
>
>                 Key: JBIDE-18312
>                 URL: https://issues.jboss.org/browse/JBIDE-18312
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: browsersim
>            Reporter: Burr Sutter
>            Assignee: Ilya Buziuk
>            Priority: Blocker
>             Fix For: 4.2.0.CR2
>
>         Attachments: hybrid1001.zip, post_error.png
>
>
> I will attach the project.
> The $.ajax post does not fire correctly from inside of CordovaSim - but it does via the iOS Simulator and from a real Android Device.  Nothing in the error message on the client-side.



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jbosstools-issues mailing list