Member Avatar for doctorphp

Hi everyone. I am having some trouble with my PHP and jQuery.

<script>
function solveError(id) 
{
        $('#loading').html('<img src="resources/images/loading.gif" width="16" height="16" />').load('solve_error.php?id=' + id + '');
}
</script>

And here is the PHP

<a href="#" title="Solved" onclick="solveError('<?php echo $error['error_id']; ?>');"><img src="resources/images/icons/tick_circle.png" alt="Solved" /></a>

When I get rid of the id variable from the solveError() function it works but when I have the id variable it stops working. Please help.

Thanks in advance,
Cameron

What is in solve_error.php? Does it work if you put something like exit('hello'); on the top of that page? jQuery is very good at hiding errors.

Member Avatar for doctorphp

At the moment is just echoes "Solved" but I will add some PHP and MySQL to it once I can sort this problem out.

Erm, does it work if you use $.ajax instead?

Member Avatar for doctorphp

How would I do that?

Well, it's just a guess, something I would try, but anyway, something like this:

function solveError(id) 
{
        $('#loading').html('<img src="resources/images/loading.gif" width="16" height="16" />');
        $.ajax('solve_error.php', {data:{id:id}, complete:function(o,s){$('#loading').html(o.responseXML);}});
}
Member Avatar for doctorphp

Thanks, I'll give it a try :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.