basically, i've got ajax call returning data based on ajax request such :
var thisid = jquery(this).data("id"); jquery.ajax({ type: "get", url: pluginurl + "/****/templates/files/ajax_controller.php", data: "ajaxaction=addid&id=" + thisid, success: function(data) { if(data === "success") { var oldid = jquery("input").find("[data-id='" + thisid + "']"); if(oldid) { alert("valid oldid!"); oldid.val("added!"); oldid.attr('disabled', 'disabled'); } } });
what's happening alert()
executing, not val()
or attr
it's simple i'm overlooking
i believe you've got bit wrong.
var oldid = jquery("input").find("[data-id='" + thisid + "']");
the above looks elements matching [data-id='" + thisid + "']
inside <input>
s.
try replacing with:
var oldid = jquery("input[data-id='" + thisid + "']");
plus, pointed out user roasted, if
condition incorrect. should be:
if(oldid.length > 0) { ... }
Comments
Post a Comment