Hi, I need to insert/update data by using link or image
I need a code how to call post data using jquery !
< a href="some.asp" onClick="someaction, value to send" > Link
Please help
Hi, I need to insert/update data by using link or image
I need a code how to call post data using jquery !
< a href="some.asp" onClick="someaction, value to send" > Link
Please help
HTML
<a href="some.asp" class="upload">Link</a>
<input type="hidden" name="parameter" value="value-to-send" />
Code
$(function() {
$('.upload').click( function() {
$.post( $(this).attr('href'),
$(this).next('input[type=hidden]').serialize(),
function(data) { do something with returned data } );
return false; // cancel link default action
});
});
You might also want to check out the documentation at jQuery.com, especially the section on How jQuery Works.
Have a look in the Jquery-Documentation and change the function call by attaching the trigger later, so that it looks this-alike:
HTML:
<a id="myid" href="javascript:void(0);">My link</a>
<div id="result"></div>
Code:
$("#myid").click(function() {
$.ajax({
type: 'POST',
url: 'some.asp',
success: function(result) {
if(result != "false") {
$("#result").html(result);
}
}
})
});
(untested)