2

I currently have the following javascript:

function updateView(set) {
    alert(set);

    $.post( "show_cards", function( data ) {

    });
}

I'm getting a 404 for show_cards even though I have a controller show_cards.php:

<?php

//show_cards.php

class Show_Cards extends CI_Controller {
    public function index() {
        $this->load_page();
    }

    public function load_page() {

        $this->load->view('show_cards_view');
    }
}

Why won't this work? It isn't able to find show_cards.php and is giving me a 404. Why is this?

1
  • 1
    What is the full URL of the request that gives 404? Commented Oct 14, 2013 at 5:26

1 Answer 1

2

Ya, because ( i think ) you didn't define it correctly. You just have to load your controller class (i know you knew it), ex http://example.com/. It will load default controller on your CI (if you set it to show_cards controller) it will load index() function in show_cards class. And in your index, you load load_page() function that you have loaded show_cards_view view in it. do you really already create the view file (show_cards_view.php)? I don't know where you created your javascript above. And I want to ask you. What is your purpose to create that function (javascript). it will help me to help you if you describe all your need and your purpose to create those functions. comment it back!

If you want build a communication between view and controller i suggest you to use ajax, it will make your site more dynamic.

Sign up to request clarification or add additional context in comments.

1 Comment

ya, i see. but it will be better to read (by human, for me) if we use an usual ajax writing. :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.