create a hidden element that has a value by default and have the ajax script reset that elements value to be blank.
then in the insert behavior for the client, click the lightning bolt next to trigger and select the hidden element.
this will cause the insert to trigger only if the hidden element has a value. since the ajax script clears it's value, it will prevent the insert.