Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9315897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:28:42+00:00 2026-06-19T02:28:42+00:00

I am using a modal dialog opener that I want to open when a

  • 0

I am using a modal dialog opener that I want to open when a user clicks one of a few available buttons. The buttons all have a different “artist_id” associated with them. When a button is clicked, I also have a php script that should run and put the user id and artist id in a table that keeps track of the “liking” relationships. Below is the relevant code:

index.php:

//script
<script>
$(function() {
  $( "#dialog-modal" ).dialog({autoOpen: false, height: 250, width: 400, modal: true});

  $( "#opener" ).click(function() {
                       $( "#dialog-modal" ).dialog( "open" );

                       $.get('/like_artist.php', {artist_id : $(this).data('artist_id')})
                       .done(function(data) {

                             alert("Data Loaded: " + data.artist_id);

                             });

        });

  });
</script>

//button:

<button type="button" id="opener" data-artist_id="1">Play My City</button>

//dialog content (I would like to have this change based on the button clicked):

<div id="dialog-modal" title="Basic dialog">
<p>You have just liked ...</p>

<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

like_artist.php: takes a user id and artist id and puts them in the relationship table user_artists

<?php 

session_start();
require_once "database.php";
db_connect();
require_once "auth.php";
$current_user = current_user();
include_once("config.php");

    $artist_id = $_GET['artist_id'];

    $user_id = $current_user['id'];

    $query = "INSERT INTO `user_artists`
    (`artist_id`, `user_id`)
    VALUES
    (''$artist_id', '$user_id')";

    $result = mysql_query($query);

?>

The alert I have put in the top script is there to see if I am getting the correct artist_id from the data-artist_id property, but it is not returning anything.

Thank you for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:28:43+00:00Added an answer on June 19, 2026 at 2:28 am

    You’re not returning (echoing) anything in like_artist.php, naturally your AJAX response will be empty as well.

    echo json_encode(array('artist_id' => $artist_id));
    

    Then you’ll have to decode it on the frontend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I open a form as a modal dialog using ShowDialog. This dialog in turn
I'm using the jQuery UI modal dialog. I want the dialog to be fixed
My main form launches another as a modal dialog, using .ShowDialog . I want
Using racket gui library, I find I can't a real modal dialog that when
I'm using a few jQuery UI modal dialogs and the positioning of each dialog
I am using jQuery UI dialog for modal popups. I have some iframes in
I'm looking to style a modal dialog (using UI Dialog) with unique CSS that
I have a modal dialog (jqueryui) that contains an accordion (jqueryui). The accordion is
When I have only one modal dialog It works in Safari too. In this
I'm using a jQuery modal dialog (see link ) with an element that uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.