cgull 25 Light Poster

Ok, found the problem, it was the csrf.

I added my function in the config file:
$config['csrf_exclude_uris'] = array('cart/admin/orders/set_paid');

And everything is back to normal.

cgull 25 Light Poster

Hi cereal,

Sorry, I wasn't on my comupter the whole day.

My problem is that I submit the form successfuly. The input fields are cleared. Then I refresh the page, and the input fields have the values that I submitted in them again.

I will look at your code deeper tomorrow as I can't do it now.

Looked at it quickly and it is a bit different than my code, so I need to figure out why your code works and mine doesn't.

I will post here if I find the solution.

Thank you very much for all the effort.

cgull 25 Light Poster

cereal you're a STAR !!!!

I've been struggling with this problem for days, posted about it all over the world, your solution sloved the problem.

I can't thank you enough !!!

THANK YOU ! :)

cgull 25 Light Poster

Managed to solve the problem, it was a mistake in the login form:
echo form_open(site_url('auth/login', $attr);
Should be:
echo form_open(site_url('auth/login'), $attr);

cgull 25 Light Poster

Found the solution:

In the jquery I changed to success function:

var options = { 
        target: '#status',
        success: function(data) {
            if(data == 'success')
            {
                $('#status').hide();
                window.location.replace("http://thinklocal.dev/admin/province");
            }
    },
        error: function ajaxError(request, type, errorThrown)
{
    var message = "There was an error with the AJAX request.\n";
    switch (type) {
        case 'timeout':
            message += "The request timed out.";
            break;
        case 'notmodified':
            message += "The request was not modified but was not retrieved from the cache.";
            break;
        case 'parsererror':
            message += "XML/Json format is bad.";
            break;
        default:
            message += "HTTP Error (" + request.status + " " + request.statusText + ").";
    }
    message += "\n";
    alert(message);
} 
}; 

// pass options to ajaxForm 
$('#issueform').ajaxForm(options);

In my controller, if there are no errors in the form I echo success and return true:

echo "success";
return true;
cereal commented: thanks for sharing! +11
cgull 25 Light Poster

My solution to this question:
In the jquery script I am getting the category id from the link and calling my controller's function that calls the model to get the products. Then displays the result in a div with id productsList.

$('.cat').click(function(e) {
		e.preventDefault(); 
		var id = $(this).attr('id');
		$("#productList").show();
		
		$.ajax({
			 type: "POST",
			 url: "/orders/index.php/processOrder/getProducts",
			 data: {catId: id},
			 success: function(data){
	  	 $("#productList").html(data);
	 		}
			});
	});
pritaeas commented: Thanks for sharing +14