ReferenceError: event is not defined



Hello, i made this ajax call to approve some lines on my page:

    //calling ajax on click
    <button type="submit" class="btn btn-default btn-sm" id="approveLine" onclick="approveLine('.$row['id'].')"> approve</button>

	function approveLine(val) {

			global: false,
			type: 'GET',
			url: '/action.php?action=approveLine&id='+val+'',
			success: function (result) {
			error: function (request, status, error) {

It worked all good on Chrome, IE and Edge until i tried it on mozilla
it returned error : ReferenceError: event is not defined

How can i fix that?

Thanks for comments!


Place the row id in an attribute called data-rowid. That lets you pass the event to the function instead, from where you can then retrieve that id with $("rowid")


Yeah that seems did the job :slight_smile: Thanks allot! You saved me a lot of time!

This should work in all browsers?



closed #5

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.