如何在ajax调用中传递lambda expresssion值 [英] How to pass lambda expresssion value in ajax call

查看:73
本文介绍了如何在ajax调用中传递lambda expresssion值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想通过Ajax Call传递我视图的一些模型数据,



< script type =   text / javascript> 

$( document )。ready( function (){

$( #requestChange)。click(功能(){
var webUrl;
var email = $(' #x => x.StoreProfileAssociation.BusinessEmail'
webUrl = UpdateChangeRequest
$ .ajax(
{
type:' POST'
data:{' From'' '' To'' email' ' 主题'' myMOL更改请求#'' Body' :$(' #changeRequest')。val(),' Priority'' 高'},
数据类型: json
url:webUrl,
成功: function (数据){
// var json = data;
// console.log(json);
/ / $('#_ genericReport')。html('');
// $('#_ genericReport')。html(data);

},
错误: function (result){
alert(' 无法加载结果);
}
})
});
});


< / script>

异常:< pre lang = C#> jquery- 2. 2 2 .js: 1468 未捕获错误:语法错误,无法识别的表达式:#x =& gt; x.StoreProfileAssociation.BusinessEmail < / pre >







我基本上想要检索模型数据(customerEmail)并通过ajax调用将其传递给我的控制器



我尝试过:



var email = $('#x => x.StoreProfileAssociation.BusinessEmail')

解决方案

< blockquote>( document )。ready( function (){


#requestCha nge)。click( function (){
var webUrl;
var email =


' #x => x.StoreProfileAssociation.BusinessEmail'
webUrl = UpdateChangeRequest

Hi ,

I wanted to pass some model data of my view through Ajax Call,

<script type="text/javascript">

    $(document).ready(function () {

        $("#requestChange").click(function () {
            var webUrl;
            var email=$('#x=>x.StoreProfileAssociation.BusinessEmail')
            webUrl = "UpdateChangeRequest"            
            $.ajax(
                {
                    type: 'POST',
                    data: { 'From': '', 'To': 'email', 'Subject': 'myMOL Change Request for #', 'Body': $('#changeRequest').val(), 'Priority': 'High' },
                    datatype: "json",
                    url: webUrl,
                    success: function (data) {
                        //var json = data;
                        //console.log(json);
                        //$('#_genericReport').html('');
                        //$('#_genericReport').html(data);

                    },
                    error: function (result) {
                        alert('Failed to load the result');
                    }
                })
        });
    });


</script>

Exception:<pre lang="C#">jquery-2.2.2.js:1468 Uncaught Error: Syntax error, unrecognized expression: #x=&gt;x.StoreProfileAssociation.BusinessEmail</pre>




basically i want to retrieve a model data (customerEmail) and pass it to my controller from view through ajax call

What I have tried:

var email=$('#x=>x.StoreProfileAssociation.BusinessEmail')

解决方案

(document).ready(function () {


("#requestChange").click(function () { var webUrl; var email=


('#x=>x.StoreProfileAssociation.BusinessEmail') webUrl = "UpdateChangeRequest"


这篇关于如何在ajax调用中传递lambda expresssion值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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