How can I Insert data in database on link click event? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to insert a value in database when visitor click on a link.
For example:
Visitor comes on http://www.website.com/lp.php?id=broker
When he clicks on "Register now" I want to add the id value "broker" & the current time into database.
I need the javascript code to do that. I already tried all kind of scripts and I decided to ask here.

You can do this with jQuery Ajax and PHP or using HTML POST form.
http://api.jquery.com/jquery.post/
With jQuery:
$("#register_now_button_id").click(function(){
//AJAX CALL HERE
});

Related

Replace HTML content between two tokens [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have HTML content warped in between two tokens:
...<p>[ShowMore]This is <b>my</b> content.[/ShowMore]</p>...
I want to get this HTML between the two tokens and replace it with something more complex... using jQuery.
This solution will be used in CMS web site. The gole is to hide content form user and show it on click. Basically this HTML content will be replaced with a link witch will toggle (show/hide) HTML content on user click.
User can have multiple tokens on single site.
Did you mean replace [ShowMore]This is <b>my</b> content.[/ShowMore] by another text ?

PHP if previous page was certain page on my site then show alert box with message [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How could I use PHP or Javascript to check if a user's previous page was a certain page on my site and then if so, show an alert box?
This could be circumvented if a person really wanted to.
//on the page for the alert
session_start();
if($_SESSION['lastPage']=='??'){
echo 'alert';
}
//on the page you want to detect if the user came from
session_start();
$_SESSION['lastPage']=$_SERVER['REQUEST_URI'];

Dynamic form in active admin based on checkbox values using ajax [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm a newbie to rails. I need assistance to show a dynamic form in active admin. I need a check box to select either credit/debit. Based on the value selected from checkbox, I want to display two different forms. How can I do that using JS? Thanks in advance
You have to create a form partial & in that partial you can put javascript code :
<script type="text/javascript">
$(function(){
$('#checkbox_name_id').change(function() {
// call a controller action and in return render the partial
in html.
});
});
</script>

Custom handling menu clicks [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have requirement, I am showing a Menu on the right side of the partial view in MVC. I do have edit mode and view mode, in the view. When I am in edit mode, I want to ask a confirmation message to navigate or not, on the click of the menu links. Somebody please help me on this.
You could store a session variable that indicates if you can navigate away without confirmation, which you could set to false when calling the edit views. Edit: if you don't like session, you could also use the localStorage

open file dialog box in javascript and get the value of the selected file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to be able to click an Asp.net button which opens a file dialog, select a file and pass the file name to a textbox using javascript, i really do not know how to go about this.
if your input file tag is fileUploadTAG ,then try this and u will get the path of the file
document.getElementById("FileUploadTAG").value

Categories

Resources