English 中文(简体)
页: 1 未能适当执行雅氏请求
原标题:jQuery not properly executing an ajax request
  • 时间:2012-01-14 01:12:11
  •  标签:
  • jquery

I ve got another similar script running just fine, i don t see why this isn t working. Is there anything wrong with this code?

$("#lastname").keyup(function(event){
    var keyCode = event.keyCode || event.which;
    if(keyCode === 13) {
        passOnRegFront();
    }
    });
    $("#register").click(function() {
        passOnRegFront();
    });
function passOnRegFront() {
        var firstname = $("#firstname").val();
        var lastname = $("#lastname").val();
        var dataString =  &firstname=  + firstname +  &lastname=  + lastname;
        if(email==   ||  password==  ) {
            $( #success ).fadeOut(400).hide();
            $( #error ).fadeOut(400).show();
        } else {
            $.ajax({
                type: "POST",
                dataType: "JSON",
                url: "<?=base_url()?>index.php/home/passOnReg",
                data: dataString,
                json: {session_state: true},
                success: function(data) {
                if(data.registered == true) { // true means user is logged in.
                    $("#main1").hide();
                    $("#main1").load( <?=base_url()?>index.php/home/dashboard );
                }
            }
        });
        }
    }
});
最佳回答

在我通过你的法典跳出以下问题:

  • www.un.org/chinese/sc/presidency.asp 变量没有定义,从背景一来看,我会猜测你可能想要的<条码>,第1条名称:和<条码>。 您提到的其他文字的拷贝和过去错误?

  • There is an extra }); at the end of the block. Maybe that is just the end of a $(document).ready(function() { that you don t show, but obviously I can t tell how much more code you have that isn t shown - for what you have shown this is an error.

除此以外,如果你确定冷漠,就更容易阅读和辩论:从一看,你似乎正在创建<条码>。 http://www.un.org。

而另一方面,如果你考虑使用一个物体设定<条码>属性>><条码>>。 删除<代码>数据 编码,仅说:

...
data : { firstname : firstname, lastname : lastname },
...

(如,.ajax( doco)所述,贵方将设立适当的询问室。)

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签