- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个可供移动设备使用的 asp.net Web 应用程序。我使用 jQuery 和 jqMobile 来实现功能和样式。
该应用程序在 safari、google chrome、iPhone、iPad 和 Android 设备上运行良好,但除了 Blackberry torch 之外,我无法让它在任何其他设备上运行。我需要让它在版本 5 和 6 黑莓设备上工作,但似乎登录的 ajax 请求总是调用错误函数,我不明白为什么。
该应用程序包含几个页面,但我什至无法通过黑莓上的登录页面。还有其他人设法在黑莓上进行ajax调用吗?我真的不想为黑莓手机设置单独的页面
这是登录页面aspx的代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Sicon.Web.WAP.App.Pages.Mobile.Login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link href="../../JavaScripts/jquery.mobile.min.css" rel="stylesheet" type="text/css" />
<script src="../../JavaScripts/jquery.min.js" type="text/javascript"></script>
<script src="../../JavaScripts/jquery.mobile.min.js" type="text/javascript"></script>
</head>
<body>
<form id="login" runat="server" accept-charset="utf-8">
<div id="Invoices" data-role="page" data-theme="b">
<div data-role="header" data-theme="b">
<h1>
WAP - Login</h1>
</div>
<div data-role="content" data-theme="b">
<div align="center">
<img src="Sicon_LogoHz_rgb72.png" />
</div>
<ul data-role="listview" data-inset="true">
<li>
<input type="text" value="" name="username" placeholder="Username" id="username" />
</li>
<li>
<input type="password" value="" name="password" placeholder="Password" id="password" />
</li>
</ul>
<a class="login" data-role="button" data-theme="b">Login</a> <a data-role="button"
data-theme="a">Cancel</a>
</div>
</div>
</form>
<script type="text/javascript">
var _ajaxEnabled = true;
$(document).ready(function()
{
_ajaxEnabled = $.support.ajax;
});
//Get base URL
var baseUrl = "<%= ResolveUrl("~/") %>";
//Function to resolve a URL
function ResolveUrl(url)
{
if (url.indexOf("~/") == 0)
{
url = baseUrl + url.substring(2);
}
return url;
}
//Login form Login link click
$("#login a.login").click(function (e) {
//Get the form
var $form = $(this).closest("form");
//Perform login
return app.login($form);
});
//Login form submit
$("#login").submit(function (e) {
//Get the form
var $form = $(this);
//Perform login
return app.login($form);
});
//class to handle login
var app = {
login: function ($form) {
var $Username = $("#username").val();
var $Password = $("#password").val();
//Call the approve method on the code behind
$.ajax({
type: "POST",
url: ResolveUrl("~/Pages/Mobile/Login.aspx/LoginUser"),
data: "{'Username':'" + $Username + "', 'Password':'" + $Password + "' }", //Pass the parameter names and values
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
error: function (jqXHR, textStatus, errorThrown) {
alert("Error- Status: " + textStatus + " jqXHR Status: " + jqXHR.status + " jqXHR Response Text:" + jqXHR.responseText) },
success: function (msg) {
if (msg.d == true) {
window.location.href = ResolveUrl("~/Pages/Mobile/Index.aspx");
}
else {
//show error
alert('login failed');
}
}
});
return false;
}
}
</script>
</body>
</html>
最后是登录方法的代码:
/// <summary>
/// Logs in the user
/// </summary>
/// <param name="Username">The username</param>
/// <param name="Password">The password</param>
/// <returns></returns>
[WebMethod, ScriptMethod]
public static bool LoginUser( string Username, string Password )
{
try
{
StaticStore.CurrentUser = new User( Username, Password );
//check the login details were correct
if ( StaticStore.CurrentUser.IsAuthentiacted )
{
//change the status to logged in
StaticStore.CurrentUser.LoginStatus = Objects.Enums.LoginStatus.LoggedIn;
//Store the user ID in the list of active users
( HttpContext.Current.Application[ SessionKeys.ActiveUsers ] as Dictionary<string, int> )[ HttpContext.Current.Session.SessionID ] = StaticStore.CurrentUser.UserID;
return true;
}
else
{
return false;
}
}
catch ( Exception ex )
{
return false;
}
}
最佳答案
你没有说你使用的是哪个版本的jqmobile。 4.1 版本已于 4 月 7 日发布。您必须记住,jqmobile 甚至还没有 Beta 版本,并且 BB OS 5 被列为 B 级 (http://jquerymobile.com/gbs/),因此它正在获得较少关注。
您的应用程序中可能还有其他 ajax 需要处理,但登录如此简单,为什么不将其重组为简单的表单帖子?
此外,承认 BB5 是一个问题:
关于asp.net - jQuery黑莓ajax问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5567130/
我想创建后台应用程序,它将监听哪些应用程序已启动以及哪些应用程序移至前台。 请回复 如果问题不清楚会再次解释。 谢谢 最佳答案 这是你可以做的: 使用 ApplicationManager.getFo
下午好。 我开始用 java 和 blackberry 编程。 我正在开发一个带有三个窗口的应用程序,我将显示有关设备的基本信息,这些窗口已经完成并可以工作。 我需要创建一个在后台运行的进程,这个进程
如何翻转 Bitmap上下翻转? (我需要这个来在另一个程序中加载 OpenGL 纹理)。 这是我失败的尝试: stripe.png(由 Pitr@OpenClipart 提供): 翻转.java:
从 Internet 上可用于签署 BB 应用程序的内容来看,我可以猜测我们只需要用于签署应用程序的 .cod 文件,而不需要源代码。 有人可以确认这一点吗? 最佳答案 编译代码时会自动生成 .cod
我想访问闹钟。在我的应用程序中,我已成功访问日历并设置了约会,但我如何访问闹钟。请帮我。以下是我的代码 public class Alarm { private Event event;
作为应用程序的一部分,我们将在设备上的“file:///store/home/user/”位置创建一个文件 myApp.cfg。设备上的加密已启用。因此,myApp.cfg 被重命名为 myApp.c
我需要制作一个包含可点击号码的标签,这样当用户点击标签时,就会调用电话号码(或向用户显示调用电话的选项)。当我现在点击标签时,我只得到一个工具提示类型的菜单,其中包含复制数字的选项... privat
我有兴趣在我的 BlackBerry 应用程序中添加一个可拖动的 slider 。 我想知道 BlackBerry API 中是否有类似的东西,或者是否有人做过类似的东西! 最佳答案 有一个Gauge
最初开发黑莓应用的时候,并没有太在意能够支持多种屏幕分辨率。所以,我最终得到了在 320*240 分辨率下运行良好但在其他屏幕上完全困惑的代码。 我该如何解决这个问题?或者一般来说,如果不为每个资源构
我创建了一个这样的静态函数。 public static Bitmap Bitmap(String path) { Bitmap bitmap = Bitmap .ge
我需要 BlackBerry 本地化方面的帮助。我在 http://na.blackberry.com/eng/developers/resources/developer_labs.jsp#tab_
我创建了一个 RichTextField 我想让它只允许整数值。我怎样才能做到这一点? 最佳答案 你可以尝试这样的事情: public class MyRichTextField extends Ri
在 BlackBerry 平台中,我想知道是否可以/如何执行以下操作: 检索通话记录(我对来电记录特别感兴趣); 删除特定的通话记录; 最佳答案 要检索电话日志,请查看 PhoneCallLog cl
我想知道我们是否可以调整图像大小。假设我们要在黑莓屏幕上绘制一个实际尺寸为200x200且尺寸为100 x 100的图像。 谢谢 最佳答案 只是一种选择: BlackBerry - draw imag
黑莓 JDE 不包括 java.util.ArrayList ,即使它知道 java.util ?那是怎么回事? BB 有对应的类(class)吗?我不想使用数组,真的,因为我要处理的对象数量未知。为
我想使用 graphics.drawLine 方法在 drawListRow 中的黑莓 Listfield 中添加一个分隔符,但下面根本没有绘制线是我正在使用的来源 drawListRow(ListF
我正在为Blackberry设备开发一个应用程序。这个程序包含一个数据库。由于该API是在最新的API版本上提供的,因此我决定使用SQLite。 我遵循了随处都可以找到的所有示例,但是无论发生什么情况
我已将 Blackberry 4.6.0 应用程序移植到 4.7.0 上的 Storm。除了我试图控制的触摸事件之外,一切都运行良好。我在下面的方法中捕获触摸事件,它按预期执行,但问题是在我的 tou
我正在为 BB 开发一个项目。该应用程序与网络一起工作,并通过 HTTP 发送/接收数据。现在我使用队列和队列管理器。管理器从一个后台线程开始,并在 while (true) 循环中工作,检查队列中是
我想在黑莓中合并两个图像。一张图像是大图像,另一张图像是小图像。小图像的位置将由开发人员定义。有哪些可能的方法? 最佳答案 您可以使用 Graphics 类以不同的偏移量在其上绘制多个位图。查看Gra
我是一名优秀的程序员,十分优秀!