Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json response is invalid #695

Closed
wrxri opened this issue Oct 18, 2012 · 1 comment
Closed

json response is invalid #695

wrxri opened this issue Oct 18, 2012 · 1 comment

Comments

@wrxri
Copy link

wrxri commented Oct 18, 2012

i am using atmosphere 1.0 and getting json response concat with numbers at the end:
ex:

{"statusNumber":8021923,"statusTarget":"NewSessions"}50

my request:

 function updateStatus(sessionId, accountId) {
            socket = $.atmosphere;
            socket.unsubscribe();
            statusDivEl = $("td[id='newSession']");
            var request = { url:'handlers/updateStatusPage/' + sessionId + '/' + accountId,
                contentType:"application/json",
                logLevel:'debug',
                transport:'streaming',
                trackMessageLength:true,
                fallbackTransport:'long-polling'};

            request.onOpen = function (response) {
            };

            request.onReconnect = function (request, response) {
                //     alert('reconnect');
            };

            request.onMessage = function (response) {
                if (response.status == 200) {//alert(response.responseBody);
                    try {
                        var json = JSON.parse(response.responseBody);
                    } catch (e) {
                        console.log('This doesn\'t look like a valid JSON: ',
                                response.responseBody);
                       // $("td[id='"+statusTarget+"']").text("N/A");
                        return;
                    }
                   // alert(json.statusNumber);
                    var statusNumber = json.statusNumber;
                    var statusTarget = json.statusTarget;
                    $("td[id='"+statusTarget+"']").text(statusNumber);
                }

            };
@jfarcand
Copy link
Member

Please post your question using the mailing list: [email protected] . We will fill an issue only when it is confirmed, but the number seems to comes from your server side implementation (please post it as well). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants