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

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -