Jump to content

Uri In Ajax Request


newrehmi

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!!!

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...