jquery mobile上的$ .ajax [英] $.ajax on jquery mobile

查看:78
本文介绍了jquery mobile上的$ .ajax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ .ajax使用jquery移动框架无法正常运行...

$.ajax not works properly by using jquery mobile framework...

它只是让我们下载html文件....

it just let us downoad html file....

如果我们想调用'ActionMethod'然后它不起作用:

if we want to call 'ActionMethod' then it not works:

$.ajax({
   url:'Home/CallMe',
   success: function(result) {
    alert(result);
   }  // edited
});

它挂起系统......

It hangs the system...

我正在使用iPhone模拟器进行测试....

I'm using IPhone Emulator for testing....

任何人都可以让我知道为什么上面不起作用以及为什么下面使用jquery移动框架时工作?

Can anyone let me know why above not works and why below works while using jquery mobile framework?

$

.ajax({
       url:'htmlFile.htm',
       success: function(result) {
        alert(result);
      } // this line is edited later

    });

编辑:我想告诉你的另一件事是我正在使用ASP。 NET MVC ...

已编辑:
您可以尝试的最简单的操作方法示例如下:

Edited: A simplest example of action method that you can try is:

public JsonResult CallMe()
{
   return Json("I'm your response");
}

[HttpPost]也可以应用,如果你想...

[HttpPost] can also be applied, if you want...

推荐答案

您的语法不正确您错过了}

Your syntax is incorrect your missing a }

$.ajax({
   url:'controller/action',
   success: function(result) {
    alert(result);
   } // <-- add this
});

这篇关于jquery mobile上的$ .ajax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆