why the JSON.stringify(harLog) unable to be sent out by ajax?

47 views
Skip to first unread message

Lucas Luo

unread,
Jun 30, 2016, 4:51:24 AM6/30/16
to Google Chrome Developer Tools
Hi guys,

I was getting the harLog by using getHAR function.
But when using ajax to send, I found nothing happens sometime.
This is really confused me.
Because some har log was able to be sent, but some wasn't.
So, can anybody help me to point out a good way for sending har as json to the server side?

                $.ajax({
                    url: 'http://localhost:4567/test/sendHar',
                    type: 'POST',
                    data: JSON.stringify(harLog),
                    dataType: 'json',
                    error: function(d) {

                    },
                    success: function(d, s) {

                    }
                });

Best Regards,
Lucas Luo

Lucas Luo

unread,
Jun 30, 2016, 6:55:53 AM6/30/16
to Google Chrome Developer Tools
The status told me 404, why???

在 2016年6月30日星期四 UTC+8下午4:51:24,Lucas Luo写道:

PhistucK

unread,
Jun 30, 2016, 7:08:14 AM6/30/16
to Google Chrome Developer Tools
Debug your server?


PhistucK

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/5fa3eda2-3fa3-44da-b3bd-8f9d145a3808%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

krishhna G

unread,
Jun 30, 2016, 8:07:47 AM6/30/16
to Google Chrome Developer Tools
Check the data you are sending in post
Some invalid characters cam corrupt your request

Try utf encoding the string to send in ajax

Lucas Luo

unread,
Jul 1, 2016, 6:18:32 AM7/1/16
to Google Chrome Developer Tools
Thank you Krishhna G, looks worked for me.

在 2016年6月30日星期四 UTC+8下午8:07:47,krishhna G写道:

Lucas Luo

unread,
Jul 4, 2016, 12:21:37 AM7/4/16
to Google Chrome Developer Tools
Sorry for the bother again, the harLog is json, why I was unable to send it directly but JSON.stringify instead? it was converted to query string style.


在 2016年6月30日星期四 UTC+8下午8:07:47,krishhna G写道:
Check the data you are sending in post

krishhna G

unread,
Jul 4, 2016, 3:46:21 AM7/4/16
to Google Chrome Developer Tools
Try dumping data
Your data + send base 64 encoded data
And see what problem is there
You need to debug
I tried escaping and it works
Reply all
Reply to author
Forward
0 new messages