views:

89

answers:

3

Is this a valid url parameter in jquery.ajax(),

<script type="text/javascript">
   $(document).ready(function() {
    getRecordspage();
  });

  function getRecordspage() {
    $.ajax({
        type: "POST",
        url: "http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount",
        data: "",
        contentType: "application/json; charset=utf-8",
        global:false,
        async: false,
        dataType: "json",
        success: function(jsonObj) {
           alert(jsonobj);
        }
    });
}
 </script>

The url doesn't seem to go to my controller function...

+1  A: 

You're using something like mod_rewrite I asume. You should use a direct url (http://www.example.nl/page.php) I meant it is allowed to use get variables in your url...

dododedodonl
@dodo as i am using codeigniter i want to call a controller function how to do this?
udaya
Maybe you can create you own page (eg. http://www.example.com/myPageToCall.php) and this page simulates a call to a controller function with something like curl... I'm not familiar with codeigniter so I can't give you the exact solution that is something you have to do on your own ;)
dododedodonl
+1  A: 

in your url try just function name url:"main"

user1400
+1  A: 

Try setting async to true. Also, what does Firebug say?

Always use Firebug to see what's actually going on.

https://addons.mozilla.org/en-US/firefox/images/p/11828/

Alex
@Alex nothing happening when inspected through firebug post tab was null...
udaya