Jump to content

Uri In Ajax Request


newrehmi
 Share

Recommended Posts

okay guys, hello how are you: I want to simply try using ajax in my codeigniter system. This is what I am trying to do, I ll write the example first:

function downloadText(url, callbackFunction){var XMLHttpRequestObject = false;if (window.XMLHttpRequest){XMLHttpRequestObject = new XMLHttpRequest();}else if (window.ActiveXObject){XMLHttpRequestObject = newActiveXObject("Microsoft.XMLHTTP");}if(XMLHttpRequestObject){XMLHttpRequestObject.open("GET", url);XMLHttpRequestObject.onreadystatechange = function(){if (XMLHttpRequestObject.readyState == 4 &&XMLHttpRequestObject.status == 200){callbackFunction(XMLHttpRequestObject.responseText);delete XMLHttpRequestObject;XMLHttpRequestObject = null;}}XMLHttpRequestObject.send(null);}}

I tried to run the event downloadText("<?php echo base_url()."my_controller/some_function"; ?>",alert); but seems like it alert nothing..? any method to run ajax request with this type of uri? btw, the actual uri is this:http://cms/index.php/my_controller/some_function". p/s: I echoed "test" in function some_function() Thx!!!

Edited by newrehmi
  • Like 1
Link to comment
Share on other sites

why you need to calback alert() ? you can simply use it inside the function

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...