Open a JQuery modal with PHP link -
on website have link open modal window in html , works fine, when try , change php link , add variable link code modal window doesn't open.
here code.
php
echo "<a href=\"#accsettings1?ip_address={$ip_address}\" class='btn btn-small btn-primary hidden-tablet hidden-phone' data-toggle='modal' data-original-title='add'>add</a>"; html
<div id="accsettings1" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel1" aria-hidden="true"> jquery
var modal = function (element, options) { this.options = options this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } modal.prototype = { constructor: modal , toggle: function () { return this[!this.isshown ? 'show' : 'hide']() } , show: function () { var = , e = $.event('show') this.$element.trigger(e) if (this.isshown || e.isdefaultprevented()) return this.isshown = true this.escape() this.backdrop(function () { var transition = $.support.transition && that.$element.hasclass('fade') if (!that.$element.parent().length) { that.$element.appendto(document.body) //don't move modals dom position } that.$element .show() if (transition) { that.$element[0].offsetwidth // force reflow } that.$element .addclass('in') .attr('aria-hidden', false) that.enforcefocus() transition ? that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : that.$element.focus().trigger('shown') }) } , hide: function (e) { e && e.preventdefault() var = e = $.event('hide') this.$element.trigger(e) if (!this.isshown || e.isdefaultprevented()) return this.isshown = false this.escape() $(document).off('focusin.modal') this.$element .removeclass('in') .attr('aria-hidden', true) $.support.transition && this.$element.hasclass('fade') ? this.hidewithtransition() : this.hidemodal() } , enforcefocus: function () { var = $(document).on('focusin.modal', function (e) { if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { that.$element.focus() } }) } , escape: function () { var = if (this.isshown && this.options.keyboard) { this.$element.on('keyup.dismiss.modal', function ( e ) { e.which == 27 && that.hide() }) } else if (!this.isshown) { this.$element.off('keyup.dismiss.modal') } } , hidewithtransition: function () { var = , timeout = settimeout(function () { that.$element.off($.support.transition.end) that.hidemodal() }, 500) this.$element.one($.support.transition.end, function () { cleartimeout(timeout) that.hidemodal() }) } , hidemodal: function (that) { this.$element .hide() .trigger('hidden') this.backdrop() } , removebackdrop: function () { this.$backdrop.remove() this.$backdrop = null } , backdrop: function (callback) { var = , animate = this.$element.hasclass('fade') ? 'fade' : '' if (this.isshown && this.options.backdrop) { var doanimate = $.support.transition && animate this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .appendto(document.body) this.$backdrop.click( this.options.backdrop == 'static' ? $.proxy(this.$element[0].focus, this.$element[0]) : $.proxy(this.hide, this) ) if (doanimate) this.$backdrop[0].offsetwidth // force reflow this.$backdrop.addclass('in') doanimate ? this.$backdrop.one($.support.transition.end, callback) : callback() } else if (!this.isshown && this.$backdrop) { this.$backdrop.removeclass('in') $.support.transition && this.$element.hasclass('fade')? this.$backdrop.one($.support.transition.end, $.proxy(this.removebackdrop, this)) : this.removebackdrop() } else if (callback) { callback() } } } so if remove
?ip_address='.$ip_address.' the modal box works fine, there way in can send variable?
the hash should come after parameters
href="?ip_address='.$ip_address.'#accsettings1"
Comments
Post a Comment