English 中文(简体)
ajax
原标题:ajax post with jQuery
  • 时间:2011-03-02 02:46:50
  •  标签:
  • jquery

如果某一要素被点击,是否可以采用POST方法提交一个身份证? 我认为,“Query”在AJAX fanction建造了一座建筑。

<span id="submitThisID"></span>
最佳回答
$( #submitThisId ).click(function() {
  $.post("postTo.php", { id: $(this).attr( id ) }, function(response) {
    alert(response);
  });
});

这将使您的出任。 可查阅:$id =_$_POST[id];

Whatever the postTo.php file returns will be alerted to the screen (response).

http://www.un.org。 送上同一页并做一些服务器方面的行动(问询等),你只需要把类似于以下代码的东西放在你网页上:

<?php 
  if (isset($_POST[ id ])) {
    $id = $_POST[ id ];
    // Perform some db queries, etc here
    $response =  Format a response here ; // Format a response

    // This will return your formatted response to the $.post() call in jQuery 
    return print_r($response);
  } 
?>

当这种“答复”(文本、html等)被退回到“质量”时,你可以使用简单的 j子,在必要时将其插入网页,并改变页面。

问题回答
#submitThisID.post(
     http://example.com/ ,
    {
         foo :  bar ,
    },
    function (data) {
        console.log(  data:   + data );
    }
);

It s definitely possible: $.post().

然而,你的问题没有意义。 设在吉大港的吉大港山区员额的提价以数字/数值为平价。 http://en.wikipedia.org/wiki/POST_%28HTTP%29”rel=“nofollow”POST Body。

Name: Jonathan Doe
Age: 23

内容识别是否为名称或价值? 什么是?

是的:

              $( #submitThisID ).click(function({
                 var id = $(this).attr( id );
                 $.ajax({
                    url: /index.php/ajax/ ,
                    type: post ,
                    dataType: json ,
                    data:{
                        id:id;
                    },
                    success:function(data){
                       console.log( ajax success! );
                    }
                 });
             });




相关问题
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: &...

热门标签