Jump to content

Recommended Posts

  • Administrators
Posted

Looking for a little help with my first AJAX call I've tried.  It keeps telling me the function "mark complete" is not defined but I see it as though it is.

My jQuery at top of page:

<!--Task jQuery/Ajax Call-->
<script>
    $(document).ready(function markcomplete(taskid,projectid)
    {
        $.ajax({
            url : 'scripts/submit.php?taskid='+taskid+'&projectid'+projectid+'submittype=7', // give complete url here
            type : 'post';
        });
    });
</script>

My html/php:

echo '<li class="open">
                                <img onClick="markcomplete('.$projectid.','.$tasks['id'].')" src="images/ico-redx.png" style="margin-left:8px;margin-right:20px;"/>'.
                                $tasks['task_name'].'
                              </li>';
  • Administrators
Posted

<!--Task jQuery/Ajax Call-->
<script>
function markcomplete(taskid,projectid)
{
$.ajax({
url : 'scripts/submit.php', // give complete url here
type : 'post',
data : { taskid : taskid, projectid : projectid, submittype : 7},
success: function (data) {
// returns from server on success
console.log(data);
},
failure: function (error) {
// returns here on error
console.log(data);
}
});
}
</script>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...