javascript - Ajax & jQuery: Sending data to php script -


$("a.star").click(function(e){   e.preventdefault();   var dataid = $(this).data('id');  $.ajax({     type: "post",     url: "/engine/save.php",     data: "id=dataid"     success: {           alert("ffs work " + data);      } }); return false; });   <a href="javascript:void(0)" data-id="7" class="star">test</a> 

how can send data-id save.php (/engine/save.php?id=7) successfully? tried , no luck.

just with

data: { id : dataid }, 

the benefit of using object (instead of string concatenation) don't need worry escape value passed along ajax call


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -