Click here to Skip to main content
14,364,335 members

Web Development

 
PinnedHow to get an answer to your question Pin
Chris Maunder4-Sep-10 3:25
adminChris Maunder4-Sep-10 3:25 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 23:40
adminChris Maunder12-Jul-09 23:40 
QuestionPlayer ranking Pin
padre_17-Nov-19 6:16
memberpadre_17-Nov-19 6:16 
QuestionMessage Closed Pin
14-Nov-19 7:23
memberMember 1465555114-Nov-19 7:23 
QuestionTransaction scope and web apis Pin
Ger Hayden14-Nov-19 0:16
memberGer Hayden14-Nov-19 0:16 
AnswerRe: Transaction scope and web apis Pin
Eddy Vluggen14-Nov-19 0:42
mveEddy Vluggen14-Nov-19 0:42 
PraiseRe: Transaction scope and web apis Pin
Ger Hayden14-Nov-19 1:07
memberGer Hayden14-Nov-19 1:07 
GeneralRe: Transaction scope and web apis Pin
Richard Deeming14-Nov-19 2:33
mveRichard Deeming14-Nov-19 2:33 
GeneralRe: Transaction scope and web apis Pin
Eddy Vluggen14-Nov-19 2:46
mveEddy Vluggen14-Nov-19 2:46 
GeneralRe: Transaction scope and web apis Pin
Richard Deeming14-Nov-19 2:55
mveRichard Deeming14-Nov-19 2:55 
GeneralRe: Transaction scope and web apis Pin
Eddy Vluggen14-Nov-19 3:17
mveEddy Vluggen14-Nov-19 3:17 
GeneralRe: Transaction scope and web apis Pin
Ger Hayden14-Nov-19 11:15
memberGer Hayden14-Nov-19 11:15 
AnswerRe: Transaction scope and web apis Pin
Richard Deeming14-Nov-19 3:42
mveRichard Deeming14-Nov-19 3:42 
GeneralRe: Transaction scope and web apis Pin
Ger Hayden14-Nov-19 11:13
memberGer Hayden14-Nov-19 11:13 
QuestionMessage Closed Pin
11-Nov-19 2:23
memberMember 1465157911-Nov-19 2:23 
QuestionWorkBox is not broadcasting updates. Pin
Member 1088816411-Nov-19 4:53
memberMember 1088816411-Nov-19 4:53 
SuggestionMessage Closed Pin
6-Nov-19 22:43
memberyuwee6-Nov-19 22:43 
QuestionPlease help: “Invalid argument supplied for foreach()” in Wordpress Pin
Member 146471226-Nov-19 14:28
memberMember 146471226-Nov-19 14:28 
AnswerRe: Please help: “Invalid argument supplied for foreach()” in Wordpress Pin
Richard MacCutchan6-Nov-19 22:38
protectorRichard MacCutchan6-Nov-19 22:38 
AnswerRe: Please help: “Invalid argument supplied for foreach()” in Wordpress Pin
jkirkerx7-Nov-19 13:29
professionaljkirkerx7-Nov-19 13:29 
Questionweb development Pin
Member 142901874-Nov-19 2:55
memberMember 142901874-Nov-19 2:55 
AnswerRe: web development Pin
Richard MacCutchan4-Nov-19 3:27
protectorRichard MacCutchan4-Nov-19 3:27 
QuestionJquery fuction not called when I append achor tag . Pin
KGr2830-Oct-19 5:29
memberKGr2830-Oct-19 5:29 
So initially when I call my view it pulls the files from the database which users have uploaded and it allows users to delete those files if they don't need them anymore , this is done by when they click on the specific Actionlink, it calls a jquery function which calls my ajax which calls my Remove() Function in my controller , when the files are deleted I append the new list back to the customer.

My Issue: When the new list is appended back, the jquery function is no longer called and it goes directly to the method in my controller. I checked my html anchor-tag in my developer tools of both the appended files and the originally uploaded files and they are identical , I am not sure what is causing this issue, and help will be greatly appreciated.


Here is the anchor tags that work initially when the page is loaded:

<div class="portlet-body form " id="attachments">
                                        @if (ViewBag.file != null)
                                        {
                                            foreach (var x in ViewBag.file)
                                            {
                                                if (string.IsNullOrWhiteSpace(x.FileName))
                                                {
                                                    continue;
                                                }
                                                @Html.ActionLink(" ", "Remove", "Chargeback", new { name = (string)x.FileName, filePath = (string)x.FilePath }, new { @class = "fas fa-trash-alt", @id = "uploadsGif" })                                                
                                                @Html.ActionLink((string)x.FileName, "DownloadFile", "Chargeback", new { name = (string)x.FileName, id = "uploads" }, null)
                                                DateTime.Now.ToString("MM/dd/yyyy");
                                            }
                                        }
  </div>


Here is my jquery function which is appending my achor-tag/ActionLink:

$("#uploadsGif").click(function () {

            debugger;

              ...

            debugger;
             $.ajax({
                type: 'POST',
                url: "/Chargeback/Remove",
                dataType: 'json',
                data: {
                    name: name,
                    filePath: filePath
                },
                success: function (data) {

                    debugger;
                    $("#lblresponce").append("File has been successfully removed");

                    setTimeout(function () {
                        $("#lblresponce").empty();
                    }, 5000)
                    debugger;
                    $("#attachments").empty();
                    $.each(data, function (i, item) {
                        $("#attachments").append('<a class="fas fa-trash-alt" href=/Chargeback/Remove?name=' + data[0].FileName + ';filePath=' + data[0].FilePath + 'id="uploadsGif"'+'>' + '</a>'); --> ISSUE                       $("#attachments").append('<a href=/Chargeback/DownloadFile/uploads?name=' + data[0].FileName +'>' + data[0].FileName + '</a>');
                    });

                },
                error: function (data) {

                }

             });
             debugger;
          return false;

        })

AnswerRe: Jquery fuction not called when I append achor tag . Pin
Richard Deeming30-Oct-19 6:30
mveRichard Deeming30-Oct-19 6:30 
GeneralRe: Jquery fuction not called when I append achor tag . Pin
KGr2830-Oct-19 9:03
memberKGr2830-Oct-19 9:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.