Ajax success data not show script tag

I have use a layout cshtml page and i want a particular div html replace after ajax post replace a html of div. Html easily replace but the script not load properly my page is My.cshtml given below

$('.DeleteBtnFT').click(function () { var EmpId = $("#EmployeeId").val(); $('#FTEdit').html(""); var confirm1 = confirm('Are you sure you want to delete this record ?'); if (confirm1) { $.ajax({ url: "/Assignment/Delete", type: 'POST', data: { 'ID': this.id, 'EmpID': EmpId }, success: function (data) { alert(data); Issue:- // In data show script tag var dd = $(data).find("#Assignment").html(); // In dd not show script tags // var dom = $(data); // dom.filter('script').each(function () { // $.globalEval(this.text || this.textContent || this.innerHTML || ''); // }); // var dd = $(dom.find("#Assignment").html()); // alert(dd); // alert(dom.find('#Assignment').html()); //$('#Assignment').html(dom.find('#Assignment').html()); // $("#Assignment").html(dd); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("error"); // $.getScript("@Url.Content("~/Content/js/jquery-1.8.3.min.js")"); } }); } else { return false; } });

My.cshtml

@model HRMS.Models.AssignmentViewModel @{ ViewBag.Title = "Assignment"; Layout = "~/Views/Shared/AdminLayout.cshtml"; } <div id="Assignment"> <script src="@Url.Content("~/Content/js/jquery-1.8.3.min.js")"></script> <script type="text/javascript"> $(document).ready(function () { $('.CreateBtnFT').click(function () { var EmpId = $("#EmployeeId").val(); alert(EmpId); var url = '@Url.Action("Create", "Assignment")?EmpId=' + EmpId; $('#FTEdit').html(""); $('#FTEdit').load(url); }); $('.EditBtnFT').click(function () { var url = '@Url.Action("Edit", "Assignment")'; url = url + "?ID=" + this.id; $('#FTEdit').html(""); $('#FTEdit').load(url); }); $('.DeleteBtnFT').click(function () { var EmpId = $("#EmployeeId").val(); $('#FTEdit').html(""); var confirm1 = confirm('Are you sure you want to delete this record ?'); if (confirm1) { $.ajax({ url: "/Assignment/Delete", type: 'POST', data: { 'ID': this.id, 'EmpID': EmpId }, success: function (data) { // var dom = $(data); // dom.filter('script').each(function () { // $.globalEval(this.text || this.textContent || this.innerHTML || ''); // }); // var dd = $(dom.find("#Assignment").html()); // alert(dd); // alert(dom.find('#Assignment').html()); //$('#Assignment').html(dom.find('#Assignment').html()); // $("#Assignment").html(dd); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("error"); // $.getScript("@Url.Content("~/Content/js/jquery-1.8.3.min.js")"); } }); } else { return false; } }); }); </script> <!-- collapsible --> <div class="page_collapsible" id="body-section16">Assignment<span></span></div> <div class="main-box"> <div class="collapse-box"> <span id="FTEdit"></span> <input type="hidden" id="EmployeeId" name="EmployeeId" value="@ViewBag.EmployeeId" /> <div class="text-right"><span class="CreateBtnFT btn btn-info">Create New</span></div> <div class="panel-body"> <div class="adv-table"> <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline" role="grid"> <div class="panel-body"> <section id="no-more-tables"> <table class="table table-bordered table-striped table-condensed table-responsive cf"> <thead class="cf"> <tr> <th>Assignment</th> <th class="numeric">Action</th> </tr> </thead> <tbody> @if (Model.AssignmentViewModels != null) { foreach (var item in Model.AssignmentViewModels) { <tr> <td data-title="Code">@item.Assignment</td> <td data-title="Volume" class="numeric"> <span><spna id="@item.Id" class="EditBtnFT"> <img src="@Url.Content("~/Content/images/edit.png")" alt="edit" /></spna></span> <span><span id="@item.Id" class="DeleteBtnFT"> <img src="@Url.Content("~/Content/images/delete.png")" alt="Delete" /></span></span> </td> </tr> } } else { <tr> <td colspan="2">No Records</td> </tr> } </tbody> </table> </section> </div> </div> </div> </div> </div> </div>

Main issue :

alert(data); //show script tag in Assignment div var dd = $(data).find("#Assignment").html(); // not show script tag in Assignment div

So confused in this error

Category:c# Time:2018-12-22 Views:3

Related post

  • XMP data not showing up in the custom file info panels when upgraded to CC 2014-01-09

    For several versions of Photoshop, I have been able to use a modified custom file info panel to input, update, and track psd files. With each version of photoshop there are always some changes in the way the object data is handled. The lastest challe

  • how to use jquery ajax success data 2011-07-05

    I'm constantly running into an issue where i am unable to use the ajax success data to perform another function. as per below $("#addproperty_state").keyup(function(){ var vardata = $(this).val(); var urlPro ="<?php echo HTTP_PHP; ?>ajax_common

  • Can't tag my files. Right-clicking a file and clicking properties does not show a tags option in the details tab. 2013-04-05

    The details pane is visible, but the tags option is not. Even right-clicking a file and clicking properties does not show a tags option in the details tab. This has happened with all the file types I tried so far, which are jpg, png, gif and avi. ---

  • Jquery AJAX Json Response data not showing up in browser 2013-05-29

    The ajax request dataType must be sent as xml due to the fact that the API only xml. I am using a plugin script to allow me to bypass the cross domain issue. The script is found below. The response is returned as json because of the plugin being used

  • Returned data not showing in source code, How do I select Ajax Loaded Data? 2011-05-01

    I am making a Category Tree Selection for eBay Categories. I have a select box... <div id="div_firstCat"> <select id="slct_firstCat" name="slct_firstCat" size="33"> <option value="353">Antiques</option> <option value="550"

  • ajax post does not show in firebug console 2010-12-14

    I seem to miss something here. When executing an ajax GET firebug shows it in the console, but when executing a POST it doesn't show in the console? Am I in need of coffee or is this something som others have experienced too? (using windows/FF 3.6.13

  • JSON data not showing when grid in dynamic tab? 2011-05-26

    My grid isnt showing data when put to tab. This grid, store, model, JSON are working when renderd to body or div, or as a part of a viewport. Only not showing when put in tab, that is also created using JSON and Tree! This is a (sometimes)working exa

  • Calling unblockUI in ajax success callback not working (IE 8) 2011-06-07

    I have the following code that I'm running on every page: $(document).ready(function () { $(document).ajaxStart($.blockUI); $(document).ajaxStop($.unblockUI); $("form").submit(function() { if ($(this).valid() == true) { $.blockUI(); } }); }); This co

  • rails 3 - ajax form ajax:success event not being called 2012-01-23

    After much troubleshooting, I am not able to figure out why my form's ajax:success callback is not being called in rails 3. Following is the code ultimately generated in my view: JS Code: $(function() { $("#myform").bind('ajax:success', function(data

  • DesignTime data not showing in Blend when bound against CollectionViewSource 2009-09-19

    I have a datatemplate for a viewmodel where an itemscontrol is bound against a CollectionViewSource (to enable sorting in xaml). <DataTemplate x:Key="equipmentDataTemplate"> <Viewbox> <Viewbox.Resources> <CollectionViewSource x:K

  • JQuery Ajax post data not arriving 2010-06-30

    my Ajax post data is not arriving - any clues please. The data is a serilaized form that "alerts" correctly with all the data using this $(document).ready(function() { var serial = $('#frm_basket').serialize(); alert(serial); $.ajax({ url: "basket-ca

  • Data attributes and script tags 2011-03-01

    I have a project I'm working on called Natalie. What it does, (twitter.com is a good example if you don't understand my explanation) is it uses the hash tag, to load a page via XHR, and then inserts it into the page, so you can have a generic look th

  • jQuery - how to wait for image load from ajax() success data? 2011-04-11

    I have jquery ajax() function: $.ajax({ type: "POST", url: 'ajax.php', data: 'url='+variable, success: function(data){ $('#mydiv').html(data); } }); my ajax response (data variable) is similar to this: <a id="90" href="mylink"><img src="myim

  • jQuery.ajax success callback not called although Pyramid did return response 2011-07-08

    I have this simple jQuery ajax post to a Pyramid webapp. Ajax call: $.ajax({ type: 'POST', url: 'http://localhost:6543/test', dataType: 'json', data: JSON.stringify({"username":"demo","email":"[email protected]","Password":"1234"}), success: functio

  • AJAX- response data not saved to global scope? 2011-07-13

    I am having the issue of my below shown lines not storing the variable into the global scope: var somedata; $.ajax({ cache: false, url: verification_url, success: function(data){ somedata = data; } }); alert(somedata); // Undefined What am I doing wr

  • Rad Ajax Loading Panel not showing up on postback in asp.net page 2011-10-18

    I have been at this for a couple of hours now. I have a Aspx page, with a couple user controls. Whenever I call any javascipt on the user control the listview updates but does not show the dialog. Can anyone please tell me why or any information. Her

  • Navigation Pane in Windows Live Photo Gallery does not show People Tags - how do I get this back? 2012-10-27

    I am using Windows Live Photo Gallery build 15.4.3555.308 on Windows 7 Home Premium 64-bit and the Navigation Pane on the left no longer shows People Tags. The only choices are All photos and videos, Date taken and Descriptive Tags. I cannot find an

  • Word 2007 does not show XML tags in a pre-existing document 2013-12-12

    I have Office 2007 Pro, with the most recent updates installed. Operating system is XP pro. Here's my issue: I have a CRM system (Red Horse) that is trying to export XML data for templates into MS Word. The templates, when created in Word, include XM

  • Mac Connector - Videos Do Not show Meta Tag information 2014-12-01

    I am able to get videos loaded from my iTunes, to my Windows 7 Phone. However the Meta Tag information that is embedded into the file (and appears within iTunes) does not appear in the Zune media part of my phone. This is a little frustrating as I ha

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.493 (s). 13 q(s)