I have created a simple project in rhomobile. My home screen shows a text box and a button.
here is the code for that in index.erb
<div data-role="content">
<br /><br />
Email Address : <input type="text" name="Email" /><br />
<form method="POST" action="<%= url_for(:action =>:show_VibLoc) %>">
<input type="submit" value="Submit" />
</form>
Now I have created a new file VibLoc.erb
in settings folder which is under app folder.
in VibLoc.erb
i am showing just two buttons.
In the controller.rb
file under settings folder i have created a function show_VibLoc
in This function it renders the VibLoc.erb
file
here is the code:
def show_VibLoc
render :action => :VibLoc
end
The code compiles successfully but when i click on that button i cant see my VibLoc
view.
what i am doing wrong here??
Finally i resolved it by my self.
Instead of writing this code in
index.erb
replace it with this one
Thanks for looking at this question :)
Had faced the same issue once, the approach i found out was:
to create a .js file in the public/js folder in the project with a function to call a method from the controller :
on you .erb file or view you can have :
create a script on the same page to call our ajax method, i am also sending login information to the method :
Note: Do include
<script type="text/javascript" src="/public/js/AjaxConnector.js"></script>
to specify the source for the ajax.
hope i helped.