Simulating <a> href post via jquery

s1LX

New Member
Here is the link which works fine. It imports GMail Contacts from Google API:Link\[code\]<a id='gmailInvite' class="button icon chat" href="http://stackoverflow.com/questions/15913655/<?php echo site_url('main/gmail_invite'); ?>"><span>Import GMail Contacts</span></a>\[/code\]I am trying to repeat this functionality via \[code\]div\[/code\] button.Div button\[code\]<div class="gmailbutton" onclick="importGMailContacts()"><span class="textwhite">Import Gmail Contacts</span></a>function importGMailContacts() { var form_datahttp://stackoverflow.com/questions/15913655/= ""; $.ajax({ url: "<?php echo site_url('main/gmail_invite'); ?>", type: 'POST', data: form_data, success: function(msg) { alert(msg) return true; }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(xhr.responseText); alert(thrownError); } }); }\[/code\]When I click the div button it goes to controller method. But nothing happens.How can I simulate \[code\]href post\[/code\] from div button?
 
Top