Welcome Guest, Not a member yet? Register   Sign In
Question on CI and JavaScript
#1

[eluser]theciman[/eluser]
I have an application which uses the onChange function recommended in this forum to do an action when a selection is made via a dropdown window. After some research, I figured out how to use a Javascript to handle the onChange function which I did get working. The only issue I have is because the Javascript calls another php file to manage DB functions; the php file seems to be out of scope from CI. In other words I need to manually use php sql calls to reconnect and access the database. It knows nothing about CI. I am trying to have the javascript call a controller function so I can stay within CI and run along as usual but it is not working. Any ideas would be appreciated. If anyone has sample code which explains the process that would be great.

Thanks!
#2

[eluser]danmontgomery[/eluser]
You just need to access the file the same way you'd access any other CI file:

Quote:http://www.yourdomain.com/[index.php/]controller/method/parameter
#3

[eluser]ionutd[/eluser]
you can also use
Code:
site_url('controller_name/method')
which translates to
Code:
http://www.sitename.com/[index.php]/controller_name/method/




Theme © iAndrew 2016 - Forum software by © MyBB