aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMikael Nordfeldth <mmn@hethane.se>2015-03-08 01:34:40 +0100
committerMikael Nordfeldth <mmn@hethane.se>2015-03-08 01:36:59 +0100
commit3c5383b11c2ea99b64c395a9703def8db0426b8d (patch)
treec2ba208c1ecb23bbe95c0c2fe30781cd11a4a51f /js
parent77190c9a87f36f6dfc3fd878ca5c568c7c2d1b79 (diff)
downloadgnu-social-3c5383b11c2ea99b64c395a9703def8db0426b8d.tar
gnu-social-3c5383b11c2ea99b64c395a9703def8db0426b8d.zip
All the AJAX calls should be made with $.ajax
because we're gonna want to expect application/xml or text/xml back. There's a weird thing in Firefox where the call on line ~703 makes the web developer console output "not well formed" which is for the returned data. It is assumed to be text/xml - which it is - but the doctype says "html" (because it is first <?xml..?> followed by <!DOCTYPE html ...-> This doesn't cause any malfunction right now, just the output in the console. I'm not exactly sure how to fix it. Probably remove the DOCTYPE output for AJAX calls, but I'm not sure that's the best way. Could this maybe even be a browser/javascript/whatever bug? Because the Content-Type from the server _is_ right...
Diffstat (limited to 'js')
-rw-r--r--js/util.js42
1 files changed, 27 insertions, 15 deletions
diff --git a/js/util.js b/js/util.js
index 72fc2a58d5..e6806ce538 100644
--- a/js/util.js
+++ b/js/util.js
@@ -590,8 +590,12 @@ var SN = { // StatusNet
$(document).on('click', '.notice-options > a.popup', function (e) {
e.preventDefault();
var noticeEl = $(this).closest('.notice');
- $.get($(this).attr('href'), {ajax: 1}, function (data, textStatus, xhr) {
- SN.U.NoticeOptionPopup(data, noticeEl);
+ $.ajax({
+ url: $(this).attr('href'),
+ data: {ajax: 1},
+ success: function (data, textStatus, xhr) {
+ SN.U.NoticeOptionPopup(data, noticeEl);
+ },
});
return false;
});
@@ -692,14 +696,18 @@ var SN = { // StatusNet
// Fetch a fresh copy of the notice form over AJAX.
var url = $('#input_form_status > form').attr('action');
- $.get(url, {ajax: 1, inreplyto: id}, function (data, textStatus, xhr) {
- var formEl = document._importNode($('form', data)[0], true);
- replyItem.append(formEl);
- list.append(replyItem);
-
- replyForm = $(formEl);
- SN.Init.NoticeFormSetup(replyForm);
- nextStep();
+ $.ajax({
+ url: url,
+ data: {ajax: 1, inreplyto: id},
+ success: function (data, textStatus, xhr) {
+ var formEl = document._importNode($('form', data)[0], true);
+ replyItem.append(formEl);
+ list.append(replyItem);
+
+ replyForm = $(formEl);
+ SN.Init.NoticeFormSetup(replyForm);
+ nextStep();
+ },
});
} else {
replyForm = replyItem.children('form');
@@ -718,11 +726,15 @@ var SN = { // StatusNet
$(document).on('click', 'li.notice-reply-comments a', function () {
var url = $(this).attr('href');
var area = $(this).closest('.threaded-replies');
- $.get(url, {ajax: 1}, function (data, textStatus, xhr) {
- var replies = $('.threaded-replies', data);
- if (replies.length) {
- area.replaceWith(document._importNode(replies[0], true));
- }
+ $.ajax({
+ url: url,
+ data: {ajax: 1},
+ success: function (data, textStatus, xhr) {
+ var replies = $('.threaded-replies', data);
+ if (replies.length) {
+ area.replaceWith(document._importNode(replies[0], true));
+ }
+ },
});
return false;
});