submit event
submit event
Hi all,
I have a problem with Jquery's submit event (I'm pretty sure it's a lame one because of me being tired...
)
I'm using jquery and cakephp 1.3 to send some data in ajax. The problem is, it reloads the page with the request but doesn't uses ajax...
here is my code
- <?php
echo $this->Form->create(null, array('type' => 'get','id' => 'searchtagform',array('url' => '')));
echo $this->Form->input('tag', array('label' => '','id'=>'searchField'));
echo $form->submit(' ', array('label' => '','id' => 'searchSubmit'));
echo $form->end();
?>
- //Search Tag
$("#searchSubmit").submit(function() {
//event.preventDefault()
$(".result_display").hide('fast').html();
$('#loader').removeClass('hidden').slideDown('slow');
var tag = $("#searchField").val();
$.ajax({
type: "GET",
url: siteurl+"/photos/search/"+tag,
success: function(msg){
$('#loader').hide('fast');
$(".result_display").html(msg).slideDown('slow');
}
})
// event.preventDefault();
// return false;
});
Any idea what might be the problem?