So this was working up until I made one change, and now it's only working when I access the mobile version of the site through Chrome, but not on any mobile devices anymore. Weird thing is, since it works through the Chrome browser, I can't actually replicate the issue. This is my AJAX call:
Ext.Ajax.request({
url: '/Home/PostMessage',
// url to post msg..
method: 'POST',
params: {
message: Ext.getCmp('msgText').getValue(),
lat: initialLocation.lat(),
lng:开发者_StackOverflow initialLocation.lng(),
loc: loc,
name: '',
parentId: 0,
FBId: 0
},
success: function() {
//Ext.getCmp('post-bar').hide({type: 'pop'});
Ext.getCmp('post-bar').hide();
setTimeout(function() {
Ext.getCmp('posts-tab').doComponentLayout();
},
300);
jabsy.stores.Listpost.load();
},
failure: function() {
navigator.notification.alert('Could not post your message', // message
'Server Error!', // title
'OK' // buttonName
);
}
});
The only thing that I added was the addition FBId
parameter to the post params. The action method that gets the params looks like this:
public ActionResult PostMessage(double? lat, double? lng, string message, string loc, string name, int parentId, int FBId)
{
var match = Regex.Match(message, @"^\s*(.)(?:\1|\s)*$");
string ip = string.IsNullOrWhiteSpace(Request.ServerVariables["REMOTE_ADDR"].ToString()) ? "" : Request.ServerVariables["REMOTE_ADDR"];
if (lat.HasValue && lng.HasValue && (message.Length <= 100) && !match.Success && !string.IsNullOrWhiteSpace(message))
{
DAL dal = new DAL();
bool success = dal.spInsertMessage(message, lat.Value, lng.Value, ip, loc, name, parentId, FBId.ToString());
return Json(success);
}
else
{
return Json(false);
}
}
Like I said, it still works if you access the mobile site from Chrome.
If you want to test it yourself, go to www.jabsy.com/Home/MobileHome in a Chrome or Safari browser (has to be webkit), and try it out and confirm it works, but it doesn't post from mobile devices anymore after this one param was added. I can't for the life of me figure out why. No error pops up, they just won't post it.
Does Sencha Touch have some AJAX param limit or something? But even if they did, that should also prevent it from working through a desktop browser right?? I can't really test if it's making it to the server and THEN something is going wrong, or it's just never making it, b/c I don't know of any way to test this from a mobile device, so I'm in the dark as to what's happening.
So confused.
So I figured this out. Just for the hell of it, kind of inspired by Joey's comment - I used my Android phone to clear all cache/cookies/browsing history from it's browser, and tried it again.
It now works. I have no idea why this happened. I've updated the same exact params before, for instance, when I added the parentId
parameter right before adding the current new one, and this issue didn't take place.
No idea, but that's what solved it. If anyone has any ideas as to why, or how to prevent this from happening in the future, PLEASE comment.
精彩评论